Skip to main content

BaseChannel

Trait BaseChannel 

Source
pub trait BaseChannel:
    Send
    + Sync
    + Debug {
    // Required methods
    fn get(&self) -> Result<Option<Value>>;
    fn update(&mut self, values: Vec<Value>) -> Result<()>;
    fn checkpoint(&self) -> Result<Value>;
    fn from_checkpoint(data: Value) -> Result<Box<dyn BaseChannel>>
       where Self: Sized;
    fn type_name(&self) -> &'static str;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

The base trait for all channels.

Channels manage how state flows through the graph. Each channel has its own semantics for how it handles multiple writes in a single superstep.

Required Methods§

Source

fn get(&self) -> Result<Option<Value>>

Get the current value as JSON

Source

fn update(&mut self, values: Vec<Value>) -> Result<()>

Update the channel with new values

If multiple values are provided, the channel applies its reduction logic (e.g., last-write-wins, sum, append).

Source

fn checkpoint(&self) -> Result<Value>

Serialize the channel state for checkpointing

Source

fn from_checkpoint(data: Value) -> Result<Box<dyn BaseChannel>>
where Self: Sized,

Restore the channel state from a checkpoint

Source

fn type_name(&self) -> &'static str

Get the channel’s type name for debugging

Provided Methods§

Source

fn is_empty(&self) -> bool

Check if the channel is empty

Implementors§

Source§

impl<T> BaseChannel for EphemeralValue<T>
where T: Serialize + for<'de> Deserialize<'de> + Clone + Send + Sync + Debug + 'static,

Source§

impl<T> BaseChannel for LastValue<T>
where T: Serialize + for<'de> Deserialize<'de> + Clone + Send + Sync + Debug + 'static,

Source§

impl<T> BaseChannel for Topic<T>
where T: Serialize + for<'de> Deserialize<'de> + Clone + Send + Sync + Debug + 'static,

Source§

impl<T, F> BaseChannel for BinaryOperatorAggregate<T, F>
where T: Serialize + for<'de> Deserialize<'de> + Clone + Send + Sync + Debug + 'static, F: Fn(T, T) -> T + Send + Sync + 'static,