Skip to main content

ResourceLedger

Struct ResourceLedger 

Source
pub struct ResourceLedger<C = ()> { /* private fields */ }
Expand description

Fake resource lifecycle ledger for applying Trellis resource plans.

Implementations§

Source§

impl<C> ResourceLedger<C>

Source

pub fn assert_command_order( &self, expected: &[ResourceCommandTrace], ) -> Result<(), ResourceLedgerError>

Asserts the full applied resource command order.

Source

pub fn assert_all_resources_have_owner(&self) -> Result<(), ResourceLedgerError>

Asserts every tracked resource still has at least one owner.

Source

pub fn assert_no_orphan_resources(&self) -> Result<(), ResourceLedgerError>

Asserts every tracked live resource has at least one owner.

Source

pub fn assert_no_duplicate_close(&self) -> Result<(), ResourceLedgerError>

Asserts no duplicate close was observed.

Source

pub fn assert_no_forbidden_opened(&self) -> Result<(), ResourceLedgerError>

Asserts no forbidden resource key was opened.

Source

pub fn assert_no_wildcard_resource_opened( &self, ) -> Result<(), ResourceLedgerError>

Asserts no explicitly forbidden wildcard resource key was opened.

Source

pub fn assert_resource_not_open( &self, key: &ResourceKey, ) -> Result<(), ResourceLedgerError>

Asserts a resource is no longer open.

Source

pub fn assert_closed_scope_owns_no_resources( &self, scope: ScopeId, ) -> Result<(), ResourceLedgerError>

Asserts a closed scope owns no live resources.

Source

pub fn assert_resource_opened_once( &self, key: &ResourceKey, ) -> Result<(), ResourceLedgerError>

Asserts a resource was opened exactly once.

Source

pub fn assert_resource_closed_once( &self, key: &ResourceKey, ) -> Result<(), ResourceLedgerError>

Asserts a resource was closed exactly once.

Source

pub fn assert_resource_generation( &self, key: &ResourceKey, expected: u64, ) -> Result<(), ResourceLedgerError>

Asserts a resource has the expected command generation.

Source

pub fn assert_resource_shared_by( &self, key: &ResourceKey, expected: BTreeSet<ScopeId>, ) -> Result<(), ResourceLedgerError>

Asserts a resource is owned by the expected scopes.

Source

pub fn assert_status_is_stale( &self, key: &ResourceKey, command_revision: Revision, ) -> Result<(), ResourceLedgerError>

Asserts a status for a command revision was classified as stale.

Source

pub fn assert_status_did_not_resurrect_closed_scope( &self, scope: ScopeId, ) -> Result<(), ResourceLedgerError>

Asserts late statuses did not recreate ownership for a closed scope.

Source

pub fn assert_no_status_mutated_closed_scope( &self, ) -> Result<(), ResourceLedgerError>

Asserts status classification never mutated a closed scope’s ownership.

Source§

impl<C> ResourceLedger<C>

Source

pub fn new() -> Self

Creates an empty ledger.

Source

pub fn mark_forbidden_unless_explicit(&mut self, key: ResourceKey)

Marks a key as forbidden unless the application explicitly permits it.

Source

pub fn snapshot(&self, key: &ResourceKey) -> Option<&ResourceSnapshot<C>>

Returns the current snapshot for a resource.

Source

pub fn history(&self, key: &ResourceKey) -> Option<&ResourceSnapshot<C>>

Returns the latest live or closed snapshot for a resource.

Source

pub fn status_records(&self) -> &[HostStatusRecord]

Returns status classifications in delivery order.

Source

pub fn command_trace(&self) -> &[ResourceCommandTrace]

Returns applied resource command traces in delivery order.

Source

pub fn command_records(&self) -> &[ResourceCommandRecord<C>]

Returns applied command records with transaction/revision context.

Source§

impl<C: Clone> ResourceLedger<C>

Source

pub fn apply_result<O>(&mut self, result: &TransactionResult<C, O>)

Applies all resource commands from a transaction result.

Source

pub fn classify_status(&mut self, status: HostStatusEvent) -> HostStatusClass

Classifies a host status event without mutating graph state.

Source§

impl<C> ResourceLedger<C>

Source

pub fn to_redacted_debug_string(&self, redactor: &impl TraceRedactor) -> String

Returns deterministic redacted debug output for resource ledger snapshots.

Trait Implementations§

Source§

impl<C: Clone> Clone for ResourceLedger<C>

Source§

fn clone(&self) -> ResourceLedger<C>

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<C: Debug> Debug for ResourceLedger<C>

Source§

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

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

impl<C> Default for ResourceLedger<C>

Source§

fn default() -> Self

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

impl<C: Eq> Eq for ResourceLedger<C>

Source§

impl<C: PartialEq> PartialEq for ResourceLedger<C>

Source§

fn eq(&self, other: &ResourceLedger<C>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<C: PartialEq> StructuralPartialEq for ResourceLedger<C>

Auto Trait Implementations§

§

impl<C> Freeze for ResourceLedger<C>

§

impl<C> RefUnwindSafe for ResourceLedger<C>
where C: RefUnwindSafe,

§

impl<C> Send for ResourceLedger<C>
where C: Send,

§

impl<C> Sync for ResourceLedger<C>
where C: Sync,

§

impl<C> Unpin for ResourceLedger<C>
where C: Unpin,

§

impl<C> UnsafeUnpin for ResourceLedger<C>

§

impl<C> UnwindSafe for ResourceLedger<C>

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> 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.