Skip to main content

ProtectedTransfer

Struct ProtectedTransfer 

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

The confirmed protected state of a main process, as a new main process takes it over: the optional fingerprint key, the number of versions issued, and the confirmed header set of every cluster, clusters sorted by id and headers in their configured order. Pending proposals never travel.

There is no serde, no Clone, and Debug prints counts only. The values stay behind their Arc handles until Self::encode_into writes them into a caller-owned zeroing buffer; the key is copied into zeroing storage. The one reader is Self::restore, which accepts nothing the authoritative configuration metadata does not name.

Implementations§

Source§

impl ProtectedTransfer

Source

pub fn export<'m>( journal: &ProtectedHeaderJournal, key: Option<&FingerprintKey>, metadata: impl Fn(&str) -> Option<&'m [HealthCheckHeader]>, ) -> Result<Self, TransferError>

The confirmed state of journal and key, or why it cannot be handed over exactly: an unresolved proposal, a held value without a key, or a set the configuration metadata of its cluster does not name.

Source

pub fn restore<'m>( self, metadata: impl Fn(&str) -> Option<&'m [HealthCheckHeader]>, ) -> Result<(Option<FingerprintKey>, ProtectedHeaderJournal), TransferError>

Rebuild a fresh key and journal from the transfer, and keep a cluster’s set only when metadata, the authoritative configuration, names it exactly: same names and full HMAC fingerprints under the transferred key, in the same order. An epoch alone is never acceptance.

Source

pub fn encoded_len(&self) -> Result<usize, TransferError>

The exact number of bytes Self::encode_into appends.

Source

pub fn encode_into( &self, out: &mut Zeroizing<Vec<u8>>, ) -> Result<(), TransferError>

Append the encoding to out without ever growing it: the spare capacity must hold Self::encoded_len bytes, so no unwiped block is left behind by a reallocation.

Source

pub fn decode(bytes: &[u8]) -> Result<Self, TransferError>

Read an encoding back. Every count and length is bounded before it is used, text must be UTF-8, values must pass the per-value header rules, clusters must be strictly increasing, and nothing may follow.

Trait Implementations§

Source§

impl Debug for ProtectedTransfer

Source§

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

Formats the value using the given formatter. Read more

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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.