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
impl DeviceCheckpointTestOnly
Sourcepub fn new(
primary: &DevicePrimaryTestOnly,
component: Arc<DeviceComponentTestOnly>,
pinned: &[u8],
) -> V2Result<Self>
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.
Sourcepub fn provision(&self) -> V2Result<()>
pub fn provision(&self) -> V2Result<()>
Anchor the primary’s current complete-state digest as the component’s initial state.
Sourcepub fn acknowledge(
&self,
ctx: &V2Context,
log_id: &str,
sequence: i64,
previous_entry_hash: &[u8],
entry_hash: &[u8],
) -> Result<V2CheckpointAcknowledgement, DeviceErrorTestOnly>
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.
Sourcepub fn submit_pending(
&self,
ctx: &V2Context,
) -> (Vec<i64>, Option<DeviceErrorTestOnly>)
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.
Sourcepub fn resubmit(
&self,
ctx: &V2Context,
sequence: i64,
) -> Result<V2CheckpointAcknowledgement, DeviceErrorTestOnly>
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.
Sourcepub fn startup(&self) -> DeviceStartupStatus
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
impl Debug for DeviceCheckpointTestOnly
Source§impl V2ReceiptCheckpoint for DeviceCheckpointTestOnly
impl V2ReceiptCheckpoint for DeviceCheckpointTestOnly
Source§fn get_v2_acknowledgement(
&self,
_ctx: &V2Context,
log_id: &str,
sequence: i64,
) -> Result<V2CheckpointAcknowledgement, V2StoreError>
fn get_v2_acknowledgement( &self, _ctx: &V2Context, log_id: &str, sequence: i64, ) -> Result<V2CheckpointAcknowledgement, V2StoreError>
Read and verify the component record.