pub trait Channel:
Any
+ Send
+ Sync {
// Required methods
fn merge(&mut self, update: Box<dyn Any + Send>);
fn clone_box(&self) -> Box<dyn Channel>;
fn clear(&mut self);
fn checkpoint(&self) -> Result<Vec<u8>, PeError>;
fn type_name(&self) -> &'static str;
fn as_any(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;
// Provided method
fn is_ephemeral(&self) -> bool { ... }
}Expand description
Core channel trait — knows how to merge updates into itself.
Every state field is backed by a channel. The channel type determines merge semantics (overwrite, append, ephemeral, etc.).
Required Methods§
Sourcefn clone_box(&self) -> Box<dyn Channel>
fn clone_box(&self) -> Box<dyn Channel>
Clone the channel (for snapshot isolation during parallel execution).
Sourcefn checkpoint(&self) -> Result<Vec<u8>, PeError>
fn checkpoint(&self) -> Result<Vec<u8>, PeError>
Serialize channel state for checkpointing.
§REVIEW(002): Returns Result instead of Vec<u8>
Previously returned Vec<u8> with unwrap_or_default() on serialization
failure, which would silently produce corrupt/empty checkpoint data.
For a library promising durable execution, silent data loss is unacceptable.
Callers must handle the error (log, retry, abort checkpoint).
Sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Downcast support — returns self as &mut dyn Any.
Provided Methods§
Sourcefn is_ephemeral(&self) -> bool
fn is_ephemeral(&self) -> bool
Whether this channel should be cleared between supersteps.
§REVIEW(002): Selective clearing
ChannelStore::clear_ephemeral() previously called clear() on ALL
channels, relying on LastValue/Appender having no-op clear() impls.
This is fragile: any future Channel with a meaningful clear() that
shouldn’t run between supersteps would silently lose data. This method
lets the store ask each channel whether it participates in superstep clearing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".