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§
Sourcefn admit(&self, operation_id: OperationId)
fn admit(&self, operation_id: OperationId)
Record that we’re starting to process this operation.
Sourcefn lookup(&self, operation_id: OperationId) -> OperationState
fn lookup(&self, operation_id: OperationId) -> OperationState
Check the state of an operation.
Sourcefn get_sealed(&self, operation_id: OperationId) -> Option<SealedResponse>
fn get_sealed(&self, operation_id: OperationId) -> Option<SealedResponse>
Retrieve a sealed response.
Sourcefn seal(
&self,
operation_id: OperationId,
response: &PostcardPayload,
root_type: &TypeRef,
registry: &SchemaRegistry,
)
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.
Sourcefn remove(&self, operation_id: OperationId)
fn remove(&self, operation_id: OperationId)
Remove an admitted (but not sealed) operation, e.g. after handler failure.
Sourcefn schema_source(&self) -> &dyn SchemaSource
fn schema_source(&self) -> &dyn SchemaSource
Access the store’s schema source for looking up schemas by hash.