Skip to main content

DecisionState

Struct DecisionState 

Source
pub struct DecisionState {
    pub controllers: OrdMap<String, Arc<DecisionControllerBinding>>,
    pub tickets: OrdMap<DecisionTicketId, Arc<DecisionTicket>>,
    pub traces: PersistentDecisionLog<DecisionTrace>,
    /* private fields */
}

Fields§

§controllers: OrdMap<String, Arc<DecisionControllerBinding>>§tickets: OrdMap<DecisionTicketId, Arc<DecisionTicket>>§traces: PersistentDecisionLog<DecisionTrace>

Implementations§

Source§

impl DecisionState

Source

pub fn is_empty(&self) -> bool

Source

pub fn decision_archive_bucket_page( &self, bucket: DecisionArchivePageKey, ) -> Result<Option<DecisionArchiveBucketPage>, DecisionError>

Source

pub fn decision_archive_bucket_page_ids( &self, ) -> &OrdMap<DecisionArchivePageKey, String>

Source

pub fn paged_checkpoint_hot_state(&self) -> DecisionState

Returns the bounded hot decision state used by a paged checkpoint. Persistent maps/logs remain structurally shared; archive locator buckets are represented by the separately committed page directory.

Source

pub fn archived_history_count(&self) -> usize

Source

pub fn controller(&self, id: &str) -> Option<&DecisionControllerBinding>

Source

pub fn ticket(&self, id: DecisionTicketId) -> Option<&DecisionTicket>

Source

pub fn trace(&self, id: DecisionTraceId) -> Option<&DecisionTrace>

Source

pub fn attempt(&self, id: DecisionRequestId) -> Option<&DecisionAttemptRecord>

Source

pub const fn attempts(&self) -> &PersistentDecisionLog<DecisionAttemptRecord>

Source

pub fn decision_locator( &self, key: &DecisionHistoryKey, ) -> DecisionHistoryLocation

Returns the current hot/archive location without conflating an unavailable archive page with an absent record.

Source

pub fn decision_locator_with_provider( &self, key: &DecisionHistoryKey, provider: &dyn DecisionArchiveProvider, ) -> Result<DecisionHistoryLocation, DecisionError>

Resolves an exact decision-history location through the committed state-page directory when the bucket is not resident. Missing provider data is never reported as an absent key.

Source

pub fn archive_receipt( &self, key: &DecisionHistoryKey, ) -> Option<DecisionArchiveReceipt>

Source

pub fn archived_history_keys(&self) -> impl Iterator<Item = &DecisionHistoryKey>

Source

pub fn required_archived_dependency_page_keys( &self, ) -> Result<OrdSet<DecisionArchivePageKey>, DecisionError>

Returns the exact locator pages required to validate references from bounded hot state into archived decision history. The result is bounded by hot traces, resolved tickets, and accepted attempts rather than by total archive size.

Source

pub fn paged_checkpoint_parts( &self, ) -> Result<(DecisionState, BTreeMap<DecisionArchivePageKey, Vec<DecisionArchiveReceipt>>), DecisionError>

Separates bounded hot decision state from stable hash-prefix archive buckets. A checkpoint can rewrite only buckets touched by this archive generation instead of serializing one all-history page.

Source

pub fn from_paged_checkpoint_parts( hot: DecisionState, buckets: impl IntoIterator<Item = (DecisionArchivePageKey, Vec<DecisionArchiveReceipt>)>, ) -> Result<DecisionState, DecisionError>

Source

pub fn from_paged_checkpoint_root( hot: DecisionState, archive_bucket_page_ids: OrdMap<DecisionArchivePageKey, String>, archive_receipt_count: u64, archive_receipt_root: &str, ) -> Result<DecisionState, DecisionError>

Restores the bounded hot decision state and authenticated archive-page directory without decoding any historical locator bucket.

Source

pub fn from_paged_checkpoint_root_with_resident_pages( hot: DecisionState, archive_bucket_page_ids: OrdMap<DecisionArchivePageKey, String>, archive_receipt_count: u64, archive_receipt_root: &str, resident_pages: impl IntoIterator<Item = DecisionArchiveBucketPage>, ) -> Result<DecisionState, DecisionError>

Restores a root-only checkpoint while retaining only locator pages needed to validate hot-to-archive references. Every supplied page is authenticated against the committed directory before its receipts become resident.

Source

pub fn archive_receipt_commitment(&self) -> Result<String, DecisionError>

Source

pub fn authoritative_commitment(&self) -> Result<String, DecisionError>

Returns the authoritative decision-state commitment independently of which authenticated archive locator pages are currently resident.

Source

pub fn archived_decision_history_page( &self, cursor: Option<&DecisionHistoryCursor>, budget: DecisionHistoryQueryBudget, provider: &dyn DecisionArchiveProvider, ) -> Result<DecisionHistoryPage, DecisionError>

Source

pub fn archive_reachability( &self, provider: &dyn DecisionArchiveProvider, ) -> Result<DecisionArchiveReachability, DecisionError>

Enumerates every archive page and payload locator committed by this decision root. This is an offline GC operation; ordinary lookups still load only the exact hash bucket for the requested key.

Source

pub fn load_decision_history( &self, key: &DecisionHistoryKey, provider: &dyn DecisionArchiveProvider, ) -> Result<Option<DecisionArchiveRecord>, DecisionError>

Source

pub fn prepare_decision_archive( &self, keys: &[DecisionHistoryKey], ) -> Result<PreparedDecisionArchive, DecisionError>

Source

pub fn commit_decision_archive( &self, prepared: &PreparedDecisionArchive, provider: &dyn DecisionArchiveProvider, ) -> Result<DecisionState, DecisionError>

Source

pub fn verify_decision_archive( &self, prepared: &PreparedDecisionArchive, provider: &dyn DecisionArchiveProvider, ) -> Result<VerifiedDecisionArchiveCommit, DecisionError>

Source

pub fn commit_verified_decision_archive( &self, verified: &VerifiedDecisionArchiveCommit, ) -> Result<DecisionState, DecisionError>

Source

pub fn hot_history_commitment(&self) -> Result<String, DecisionError>

Source

pub fn decision_hot_state(&self) -> DecisionHotState

Source

pub fn append_attempt( &mut self, attempt: DecisionAttemptRecord, ) -> Result<(), DecisionError>

Source

pub fn open_tickets(&self) -> impl Iterator<Item = &DecisionTicket>

Source

pub fn validate(&self) -> Result<(), DecisionError>

Source

pub fn apply( &mut self, mutation: DecisionMutation, at: SimTime, trace_id: Option<DecisionTraceId>, ) -> Result<PreparedDecision, DecisionError>

Source

pub fn advance_time(&mut self, at: SimTime) -> Result<(), DecisionError>

Trait Implementations§

Source§

impl Clone for DecisionState

Source§

fn clone(&self) -> DecisionState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DecisionState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for DecisionState

Source§

fn default() -> DecisionState

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for DecisionState

Source§

fn deserialize<D>( deserializer: D, ) -> Result<DecisionState, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for DecisionState

Source§

impl PartialEq for DecisionState

Source§

fn eq(&self, other: &DecisionState) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for DecisionState

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for DecisionState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.