Skip to main content

SyncProjectionSink

Trait SyncProjectionSink 

Source
pub trait SyncProjectionSink:
    Send
    + Sync
    + 'static {
    // Required methods
    fn id(&self) -> &str;
    fn commit(
        &self,
        stream: &StreamId,
        seq: Seq,
        state: &Value,
        event: &Event,
    ) -> Result<(), StoreError>;

    // Provided methods
    fn on_label_set(
        &self,
        _stream: &StreamId,
        _label: &Label,
        _at: Seq,
        _state: &Value,
        _event: &Event,
    ) -> Result<(), StoreError> { ... }
    fn on_label_deleted(
        &self,
        _stream: &StreamId,
        _label: &Label,
    ) -> Result<(), StoreError> { ... }
}
Expand description

Synchronous variant of ProjectionSink. Implement this when the sink’s body is inherently blocking (file I/O, synchronous database drivers, stdlib println!), then wrap in BlockingSink to plug into the async facade.

Required Methods§

Source

fn id(&self) -> &str

Stable identifier used as the checkpoint key. See ProjectionSink::id.

Source

fn commit( &self, stream: &StreamId, seq: Seq, state: &Value, event: &Event, ) -> Result<(), StoreError>

Apply one committed event. Must be idempotent under retries.

Provided Methods§

Source

fn on_label_set( &self, _stream: &StreamId, _label: &Label, _at: Seq, _state: &Value, _event: &Event, ) -> Result<(), StoreError>

React to a label being pinned or moved. Default is a no-op, matching the async trait’s default.

Source

fn on_label_deleted( &self, _stream: &StreamId, _label: &Label, ) -> Result<(), StoreError>

React to a label being deleted. Default is a no-op, matching the async trait’s default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§