reifydb_sub_flow/operator/
apply.rs1use std::sync::Arc;
5
6use reifydb_core::{
7 interface::{catalog::flow::FlowNodeId, change::Change},
8 value::column::columns::Columns,
9};
10use reifydb_type::{Result, value::row_number::RowNumber};
11
12use crate::{
13 operator::{BoxedOperator, Operator, Operators},
14 transaction::FlowTransaction,
15};
16
17pub struct ApplyOperator {
18 parent: Arc<Operators>,
19 node: FlowNodeId,
20 inner: BoxedOperator,
21}
22
23impl ApplyOperator {
24 pub fn new(parent: Arc<Operators>, node: FlowNodeId, inner: BoxedOperator) -> Self {
25 Self {
26 parent,
27 node,
28 inner,
29 }
30 }
31}
32
33impl Operator for ApplyOperator {
34 fn id(&self) -> FlowNodeId {
35 self.node
36 }
37
38 fn apply(&self, txn: &mut FlowTransaction, change: Change) -> Result<Change> {
39 self.inner.apply(txn, change)
40 }
41
42 fn pull(&self, txn: &mut FlowTransaction, rows: &[RowNumber]) -> Result<Columns> {
43 self.parent.pull(txn, rows)
44 }
45}