pub struct BusinessStateStore { /* private fields */ }Expand description
Thread-safe host-owned authoritative business state store surviving hot-swaps and rollbacks.
Implementations§
Source§impl BusinessStateStore
Authoritative business state orchestration on BusinessStateStore.
impl BusinessStateStore
Authoritative business state orchestration on BusinessStateStore.
Sourcepub fn seed_entity(
&self,
entity_id: &str,
state: Value,
) -> Result<u64, DynamicReleaseError>
pub fn seed_entity( &self, entity_id: &str, state: Value, ) -> Result<u64, DynamicReleaseError>
Sourcepub fn global_revision(&self) -> u64
pub fn global_revision(&self) -> u64
Returns the monotonic global store revision across all entities.
§Returns
u64- Global authoritative revision number.
Sourcepub fn capture_entity_snapshots(&self) -> (u64, BTreeMap<String, (u64, Value)>)
pub fn capture_entity_snapshots(&self) -> (u64, BTreeMap<String, (u64, Value)>)
Captures a read-only snapshot of all entities and the global revision R.
§Returns
(u64, BTreeMap<String, (u64, Value)>)- Global revisionRpaired with per-entity snapshots.
Sourcepub fn subscribe_entity(
&self,
entity_id: &str,
generation_id: u64,
watched_fields: Vec<String>,
) -> Result<u64, DynamicReleaseError>
pub fn subscribe_entity( &self, entity_id: &str, generation_id: u64, watched_fields: Vec<String>, ) -> Result<u64, DynamicReleaseError>
Registers a field-filtered subscriber for entity_id owned by generation_id.
§Arguments
&str- Target entity identifier.u64- Owning release generation identifier.Vec<String>- Subset of watched fields (empty watches all changes).
§Returns
Result<u64, DynamicReleaseError>- Assigned subscription identifier.
Sourcepub fn cancel_generation_subscriptions(&self, generation_id: u64)
pub fn cancel_generation_subscriptions(&self, generation_id: u64)
Cancels all subscriptions belonging to generation_id so destroyed instances never receive callbacks.
§Arguments
u64- Retired release generation identifier.
Sourcepub fn delivered_revisions(&self, subscription_id: u64) -> Vec<u64>
pub fn delivered_revisions(&self, subscription_id: u64) -> Vec<u64>
Sourcepub fn begin_operation(
&self,
command: BusinessCommand,
) -> Result<CommandOutcome, DynamicReleaseError>
pub fn begin_operation( &self, command: BusinessCommand, ) -> Result<CommandOutcome, DynamicReleaseError>
Sourcepub fn complete_operation(
&self,
operation_id: OperationId,
next_state: Value,
changed_fields: Vec<String>,
) -> Result<CommandOutcome, DynamicReleaseError>
pub fn complete_operation( &self, operation_id: OperationId, next_state: Value, changed_fields: Vec<String>, ) -> Result<CommandOutcome, DynamicReleaseError>
Completes a previously accepted host-owned in-flight operation regardless of component hot-swaps.
§Arguments
OperationId- Host-assigned operation identifier returned bybegin_operation.Value- Authoritative post-operation entity state.Vec<String>- Field names mutated by this completion.
§Returns
Result<CommandOutcome, DynamicReleaseError>- Committed outcome or conflict error.
Sourcepub fn commit_command(
&self,
command: BusinessCommand,
next_state: Value,
changed_fields: Vec<String>,
) -> Result<CommandOutcome, DynamicReleaseError>
pub fn commit_command( &self, command: BusinessCommand, next_state: Value, changed_fields: Vec<String>, ) -> Result<CommandOutcome, DynamicReleaseError>
Synchronously validates, commits, and deduplicates a typed command in a single atomic host step.
§Arguments
BusinessCommand- Typed mutation command.Value- Resulting authoritative entity state.Vec<String>- Mutated field names.
§Returns
Result<CommandOutcome, DynamicReleaseError>- Committed or rejected outcome.
Sourcepub fn deltas_since(
&self,
entity_id: &str,
base_revision: u64,
) -> Result<Vec<BusinessStateDelta>, DynamicReleaseError>
pub fn deltas_since( &self, entity_id: &str, base_revision: u64, ) -> Result<Vec<BusinessStateDelta>, DynamicReleaseError>
Returns all authoritative deltas strictly newer than base_revision for entity_id, or StateCatchUpConflict if history wrapped.
§Arguments
&str- Entity identifier.u64- Snapshot baseline revisionR.
§Returns
Result<Vec<BusinessStateDelta>, DynamicReleaseError>- Ordered catch-up deltas fromR+1toR+n.
Sourcepub fn active_in_flight_count(&self) -> usize
pub fn active_in_flight_count(&self) -> usize
Returns the number of currently active host-owned in-flight operations.
§Returns
usize- Count of pending in-flight operations.