pub struct KernelRecord { /* private fields */ }Expand description
One durable transition (§8.1).
Every field is private and every digest is computed by KernelRecord::chain: there is no
constructor that takes a digest, so “the host recomputed the hash and disagreed” is not a
reachable state. KernelRecord::record_bytes is what the host hands to
KernelJournal::compare_and_append, and KernelRecord::expected_head is the CAS precondition
that goes with it.
Implementations§
Source§impl KernelRecord
impl KernelRecord
Sourcepub fn chain<S>(
previous: Option<&KernelRecord>,
input: &NormalizedInput,
planned_step: &S,
) -> Result<KernelRecord, RecordError>
pub fn chain<S>( previous: Option<&KernelRecord>, input: &NormalizedInput, planned_step: &S, ) -> Result<KernelRecord, RecordError>
Build the next record of an operation.
previous = None builds the genesis record: step_seq 0, no previous digest, and a payload
that must be the resolved configuration. Every later record must carry a non-genesis
payload, the same operation_id, and links to its predecessor’s digest — a second
ConfigureOperation has no legal position in a chain (§6.1: it is admissible only in
Created).
Sourcepub fn anchor(&self) -> ChainAnchor
pub fn anchor(&self) -> ChainAnchor
The three facts a successor reads off this record.
Sourcepub fn chain_after<S>(
previous: Option<&ChainAnchor>,
input: &NormalizedInput,
planned_step: &S,
) -> Result<KernelRecord, RecordError>
pub fn chain_after<S>( previous: Option<&ChainAnchor>, input: &NormalizedInput, planned_step: &S, ) -> Result<KernelRecord, RecordError>
Self::chain, anchored on the predecessor’s facts rather than on the predecessor.
The distinction is what makes §12.2’s bounded-tail restore possible at all: a restored runtime replays the tail on top of a checkpoint whose covered prefix may already have been pruned, so the record before the first tail entry no longer exists anywhere — only its digest and its sequence do, and the checkpoint carries them.
pub fn operation_id(&self) -> &OperationId
pub fn input_id(&self) -> &InputId
pub fn step_seq(&self) -> WireU64
pub fn previous_record_digest(&self) -> Option<&Digest>
Sourcepub fn expected_head(&self) -> Option<&Digest>
pub fn expected_head(&self) -> Option<&Digest>
The CAS precondition for appending this record (§8.2 line 5). None means “the operation
has no journal head yet”, which only its genesis record may assert.
pub fn canonical_input(&self) -> &CanonicalBytes
pub fn input_digest(&self) -> &Digest
pub fn step_digest(&self) -> &Digest
pub fn record_digest(&self) -> &Digest
pub fn is_genesis(&self) -> bool
Sourcepub fn record_bytes(&self) -> CanonicalBytes
pub fn record_bytes(&self) -> CanonicalBytes
Canonical bytes of the whole record — what the journal stores and what
Self::from_record_bytes reads back.
Sourcepub fn from_record_bytes(bytes: &[u8]) -> Result<KernelRecord, RecordError>
pub fn from_record_bytes(bytes: &[u8]) -> Result<KernelRecord, RecordError>
Decode a record from its journal bytes, verifying every digest it carries.
Sourcepub fn normalized_input(&self) -> Result<NormalizedInput, RecordError>
pub fn normalized_input(&self) -> Result<NormalizedInput, RecordError>
Decode the normalised input this record froze — the entry point of a rebuild (§12.2).
Sourcepub fn verify(&self) -> Result<(), RecordError>
pub fn verify(&self) -> Result<(), RecordError>
Recompute this record’s own digests from the bytes it carries.
Sourcepub fn verify_step<S>(&self, planned_step: &S) -> Result<(), RecordError>
pub fn verify_step<S>(&self, planned_step: &S) -> Result<(), RecordError>
Verify a rebuilt step against the digest this record froze (§8.1).
Sourcepub fn verify_follows(
&self,
previous: Option<&KernelRecord>,
) -> Result<(), RecordError>
pub fn verify_follows( &self, previous: Option<&KernelRecord>, ) -> Result<(), RecordError>
Verify this record follows previous (None = it claims to be a genesis).
Trait Implementations§
Source§impl Clone for KernelRecord
impl Clone for KernelRecord
Source§fn clone(&self) -> KernelRecord
fn clone(&self) -> KernelRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KernelRecord
impl Debug for KernelRecord
Source§impl<'de> Deserialize<'de> for KernelRecord
impl<'de> Deserialize<'de> for KernelRecord
Source§fn deserialize<D>(
deserializer: D,
) -> Result<KernelRecord, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<KernelRecord, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for KernelRecord
Source§impl PartialEq for KernelRecord
impl PartialEq for KernelRecord
Source§impl Serialize for KernelRecord
impl Serialize for KernelRecord
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for KernelRecord
Auto Trait Implementations§
impl Freeze for KernelRecord
impl RefUnwindSafe for KernelRecord
impl Send for KernelRecord
impl Sync for KernelRecord
impl Unpin for KernelRecord
impl UnsafeUnpin for KernelRecord
impl UnwindSafe for KernelRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.