Skip to main content

DeviceCheckpointTestOnly

Struct DeviceCheckpointTestOnly 

Source
pub struct DeviceCheckpointTestOnly { /* private fields */ }
Expand description

The primary’s view of the component (Go DeviceCheckpointTestOnly). It implements V2ReceiptCheckpoint: every acknowledgement it returns carries a component signature verified under the pinned key.

Implementations§

Source§

impl DeviceCheckpointTestOnly

Source

pub fn new( primary: &DevicePrimaryTestOnly, component: Arc<DeviceComponentTestOnly>, pinned: &[u8], ) -> V2Result<Self>

Go NewDeviceCheckpointTestOnly: bind a device primary to a component whose key the primary pinned at provisioning; from now on every durable change of the primary is anchored in the component before it takes effect. The primary’s store must not self-acknowledge (set_acknowledgement_withheld(true)). A fresh device then calls Self::provision once; a primary restored from a copy is bound again without provisioning, and its first change or startup shows whether it matches the anchored state.

Source

pub fn provision(&self) -> V2Result<()>

Anchor the primary’s current complete-state digest as the component’s initial state.

Source

pub fn acknowledge( &self, ctx: &V2Context, log_id: &str, sequence: i64, previous_entry_hash: &[u8], entry_hash: &[u8], ) -> Result<V2CheckpointAcknowledgement, DeviceErrorTestOnly>

Go AcknowledgeV2Receipt: submit the primary’s appended entry with the primary’s anchored complete-state digest, which already covers the append. The security clock is read first, with no lock held, because the clock source may take the store lock, which precedes the anchor lock. The anchor lock is then held from composing the anchored digest through the component commit, so a concurrent anchored change cannot advance the component’s digest in between.

Source

pub fn submit_pending( &self, ctx: &V2Context, ) -> (Vec<i64>, Option<DeviceErrorTestOnly>)

Go SubmitPending: submit, in log order, every appended entry of the primary that the component has not acknowledged with the same entry hash, and return the sequences acknowledged by this call with the failure that stopped it, if any. A rolled-back primary therefore resubmits its own version of an acknowledged sequence, which the component refuses.

Source

pub fn resubmit( &self, ctx: &V2Context, sequence: i64, ) -> Result<V2CheckpointAcknowledgement, DeviceErrorTestOnly>

Go Resubmit: retry the exact tuple for sequence (for example after a power loss whose outcome is unknown) and return the acknowledgement.

Source

pub fn startup(&self) -> DeviceStartupStatus

Go Startup: compare the primary with the component head before the device serves any request: frozen component, then fewer appended entries than acknowledged, then the recomputed complete-state digest against the anchored one.

Trait Implementations§

Source§

impl Debug for DeviceCheckpointTestOnly

Source§

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

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

impl V2ReceiptCheckpoint for DeviceCheckpointTestOnly

Source§

fn get_v2_acknowledgement( &self, _ctx: &V2Context, log_id: &str, sequence: i64, ) -> Result<V2CheckpointAcknowledgement, V2StoreError>

Read and verify the component record.

Source§

fn acknowledge_v2_receipt( &self, ctx: &V2Context, log_id: &str, sequence: i64, previous_entry_hash: &[u8], entry_hash: &[u8], ) -> Result<V2CheckpointAcknowledgement, V2StoreError>

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> 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, 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.