Skip to main content

Recovering

Struct Recovering 

Source
pub struct Recovering<'a> { /* private fields */ }
Expand description

A recovery under way, which Library::start_recovery began: the new replica, which nobody knows yet, holds what the backup holds of the personal space, and the keys sealed to the code there. Recovering::holds_secrets says whether the code holds the secrets, so that the person is asked how to protect them only then; Recovering::others lists the person’s other devices, which Recovering::keep keeps some of; and Recovering::finish does the rest. One dropped before it finishes removes the new replica.

Implementations§

Source§

impl Recovering<'_>

Source

pub const fn holds_secrets(&self) -> bool

Whether the code holds the secrets, which Recovering::finish takes then.

Source

pub fn others(&self) -> Result<Vec<Replica>, NodeError>

The replicas of the person’s other devices, which Recovering::finish revokes as lost, but those that Recovering::keep keeps: every replica of the person’s that is not revoked yet, but two that it revokes in any case: the one of the library that no longer unlocks that the recovery reads, if it reads one, and the one that a recovery cut short left in the same place, which the backup may list.

§Errors

Returns an error if the personal space cannot be read.

Source

pub fn others_named(&self, target: &str) -> Result<Vec<Replica>, NodeError>

The replicas of Recovering::others that target names, as Library::replicas_named finds them among them alone: those of a device, by its name or ID, one replica by its ID, or an AI agent’s by its name.

§Errors

Returns NodeError::WhichDevice if target names none of them, or several, as the library that the recovery reads, or a device revoked already, and an error if the personal space cannot be read.

Source

pub fn keep(&mut self, replicas: &[EntityId]) -> Result<(), NodeError>

Keeps replicas, of those that Recovering::others lists, in place of those kept before: Recovering::finish leaves them as they are, rather than revoke them, as the person still has their devices.

§Errors

Returns NodeError::WhichDevice if one is none of those, or if the library that no longer unlocks, which the recovery reads, names no replica of its own, which then may be any of them, and then keeps nothing new; and an error if the personal space cannot be read.

Source

pub fn finish( self, secrets: Option<&NewProtection<'_>>, now: &dyn Fn() -> u64, rng: &mut impl CryptoRng, ) -> Result<(Library, Recovered), NodeError>

Finishes the recovery: lists the new replica by the code in the personal space; takes the person’s other spaces and groups that the code is given, with what the backup holds of each, and lists it in each, by the code on the person’s record, or through a group in a space that the person reaches through a group alone; takes the secrets, if the code holds them, protected as secrets says, unless it is None; then revokes every other replica of the person’s, whose devices are lost, but those that Recovering::keep keeps, and updates the backup; in place of a library here that no longer unlocks, sets aside that library’s replica, as its last step. A recovery that fails removes the new replica.

§Errors

Returns NodeError::LibraryPassphrase if secrets is the library’s passphrase, NodeError::BackupBusy if another program updates the backup, and an error if the source cannot be read, the replica written, or the replica it replaces set aside.

Trait Implementations§

Source§

impl Drop for Recovering<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a> !Freeze for Recovering<'a>

§

impl<'a> !RefUnwindSafe for Recovering<'a>

§

impl<'a> !Sync for Recovering<'a>

§

impl<'a> !UnwindSafe for Recovering<'a>

§

impl<'a> Forget for Recovering<'a>

§

impl<'a> Move for Recovering<'a>

§

impl<'a> Send for Recovering<'a>

§

impl<'a> Unpin for Recovering<'a>

§

impl<'a> UnsafeUnpin for Recovering<'a>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more