Skip to main content

bb_ops/syscalls/triggers/
pulse.rs

1//! `Pulse` syscall - one-shot bootstrap trigger.
2
3use bb_ir::proto::onnx::NodeProto;
4use bb_runtime::atomic::DispatchResult;
5use bb_runtime::bus::OpError;
6use bb_runtime::runtime::RuntimeResourceRef;
7use bb_runtime::slot_value::SlotValue;
8use bb_runtime::syscall::values::TriggerValue;
9
10/// Marker struct.
11pub struct PulseOp;
12
13/// Op domain.
14pub const DOMAIN: &str = "ai.bytesandbrains.syscall";
15/// Op type name.
16pub const OP_TYPE: &str = "Pulse";
17
18/// Invoke fn - emits one Trigger.
19pub fn invoke(
20    _node: &NodeProto,
21    _inputs: &[(&str, &dyn SlotValue)],
22    _ctx: &mut RuntimeResourceRef<'_>,
23) -> Result<DispatchResult, OpError> {
24    Ok(DispatchResult::Immediate(vec![(
25        "trigger".to_string(),
26        Box::new(TriggerValue),
27    )]))
28}
29
30use bb_runtime::registry::OpRegistration as _BbOpsSyscallReg;
31
32inventory::submit! {
33    _BbOpsSyscallReg {
34        domain: DOMAIN,
35        op_type: OP_TYPE,
36        invoke,
37        kind: bb_runtime::registry::RegistrationKind::Syscall,
38    }
39}