Skip to main content

DerivedStateConsumer

Trait DerivedStateConsumer 

pub trait DerivedStateConsumer:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn state_version(&self) -> u32;
    fn extension_version(&self) -> &'static str;
    fn load_checkpoint(
        &mut self,
    ) -> Result<Option<DerivedStateCheckpoint>, DerivedStateConsumerFault>;
    fn apply(
        &mut self,
        envelope: &DerivedStateFeedEnvelope,
    ) -> Result<(), DerivedStateConsumerFault>;
    fn flush_checkpoint(
        &mut self,
        checkpoint: DerivedStateCheckpoint,
    ) -> Result<(), DerivedStateConsumerFault>;

    // Provided methods
    fn wants_transaction_applied(&self) -> bool { ... }
    fn wants_account_touch_observed(&self) -> bool { ... }
    fn wants_account_touch_key_partitions(&self) -> bool { ... }
    fn wants_control_plane_observed(&self) -> bool { ... }
}
Expand description

Stateful consumer interface for the dedicated derived-state feed scaffold.

This trait is intentionally synchronous for the initial scaffold so implementers can model deterministic state application and checkpointing before runtime dispatch details are fixed.

Required Methods§

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

Stable consumer name used in logs and telemetry.

fn state_version(&self) -> u32

Consumer-owned schema/state version written into durable checkpoints.

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

Stable consumer implementation version written into durable checkpoints.

fn load_checkpoint( &mut self, ) -> Result<Option<DerivedStateCheckpoint>, DerivedStateConsumerFault>

Loads the most recent durable checkpoint when present.

§Errors

Returns a structured fault when the checkpoint cannot be loaded or decoded.

fn apply( &mut self, envelope: &DerivedStateFeedEnvelope, ) -> Result<(), DerivedStateConsumerFault>

Applies one feed envelope in canonical sequence order.

§Errors

Returns a structured fault when the consumer cannot apply the event.

fn flush_checkpoint( &mut self, checkpoint: DerivedStateCheckpoint, ) -> Result<(), DerivedStateConsumerFault>

Persists a durable checkpoint for later replay or recovery.

§Errors

Returns a structured fault when checkpoint persistence fails.

Provided Methods§

fn wants_transaction_applied(&self) -> bool

Returns true when this consumer wants transaction-applied feed events.

fn wants_account_touch_observed(&self) -> bool

Returns true when this consumer wants account-touch feed events.

fn wants_account_touch_key_partitions(&self) -> bool

Returns true when account-touch events for this consumer need writable/read-only splits.

fn wants_control_plane_observed(&self) -> bool

Returns true when this consumer wants observer-side control-plane events.

Implementors§