Skip to main content

OperationStore

Trait OperationStore 

Source
pub trait OperationStore:
    MaybeSend
    + MaybeSync
    + 'static {
    // Required methods
    fn admit(&self, operation_id: OperationId);
    fn lookup(&self, operation_id: OperationId) -> OperationState;
    fn get_sealed(&self, operation_id: OperationId) -> Option<SealedResponse>;
    fn seal(
        &self,
        operation_id: OperationId,
        response: &PostcardPayload,
        root_type: &TypeRef,
        registry: &SchemaRegistry,
    );
    fn remove(&self, operation_id: OperationId);
    fn schema_source(&self) -> &dyn SchemaSource;
}
Expand description

Operation state backing for exactly-once delivery across session resumption.

The default implementation is in-memory. Applications that want durability can implement this trait backed by a database.

Schemas are stored separately from payloads, deduplicated by SchemaHash.

Required Methods§

Source

fn admit(&self, operation_id: OperationId)

Record that we’re starting to process this operation.

Source

fn lookup(&self, operation_id: OperationId) -> OperationState

Check the state of an operation.

Source

fn get_sealed(&self, operation_id: OperationId) -> Option<SealedResponse>

Retrieve a sealed response.

Source

fn seal( &self, operation_id: OperationId, response: &PostcardPayload, root_type: &TypeRef, registry: &SchemaRegistry, )

Store the sealed response for an operation.

response is the postcard-encoded payload WITHOUT schemas. The store pulls needed schemas from registry, deduplicated by SchemaHash.

Source

fn remove(&self, operation_id: OperationId)

Remove an admitted (but not sealed) operation, e.g. after handler failure.

Source

fn schema_source(&self) -> &dyn SchemaSource

Access the store’s schema source for looking up schemas by hash.

Implementors§