reifydb_flow_operator_sdk/
context.rs1use reifydb_core::interface::FlowNodeId;
4use reifydb_flow_operator_abi::FFIContext;
5
6use crate::stateful::State;
7
8pub struct OperatorContext {
10 pub(crate) ctx: *mut FFIContext,
11}
12
13impl OperatorContext {
14 pub fn new(ctx: *mut FFIContext) -> Self {
19 assert!(!ctx.is_null(), "FFIContext pointer must not be null");
20 Self {
21 ctx,
22 }
23 }
24
25 pub fn operator_id(&self) -> FlowNodeId {
27 unsafe { FlowNodeId((*self.ctx).operator_id) }
28 }
29
30 pub fn state(&mut self) -> State<'_> {
32 State::new(self)
33 }
34}