Skip to main content

SpaceKeys

Struct SpaceKeys 

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

The keys of a space that a replica has, by their numbers: 0 for a space’s first key, and a random one for each key that a rotation brings, so that two rotations made at once differ; the numbers do not tell which key is newer. New changes use the newest key whose rotation counts, which the replica chooses; older changes keep the key they were made with.

Besides the space keys, a replica that the person chose holds the space’s secrets keys while its secrets are unlocked.

Implementations§

Source§

impl SpaceKeys

Source

pub fn new(epoch: u64, key: Key) -> Self

Returns the keys of a space with this one space key so far, and no secrets key.

Source

pub fn write_with(&mut self, epoch: Option<u64>)

Wraps new changes and blob keys with the key of this number from now on, or with the one of the highest number if None or if there is no key of this number. A replica writes with the newest key whose rotation counts, which a key it got may not be, and which the numbers, random ones, do not tell.

Source

pub fn writing_with(&self, epoch: u64) -> Self

The same keys, wrapping new changes with the key of this number, if there is one.

Source

pub fn epochs(&self) -> impl Iterator<Item = u64> + '_

The numbers of the space keys, in order.

Source

pub fn space_keys(&self) -> impl Iterator<Item = (u64, &Key)>

The space keys with their numbers, in order.

Source

pub fn insert(&mut self, epoch: u64, key: Key)

Adds a space key, after the space’s key has changed.

Source

pub fn get(&self, epoch: u64) -> Option<&Key>

The space key with this number.

Source

pub fn newest(&self) -> (u64, &Key)

The space key that new changes and blob keys are wrapped with, with its number: the one SpaceKeys::write_with chose, or else the one of the highest number.

Source

pub fn insert_secrets(&mut self, epoch: u64, key: Key)

Adds a secrets key, once the person has confirmed, on a replica chosen to hold the space’s secrets.

Source

pub fn forget_secrets(&mut self)

Forgets the secrets keys, when the replica locks its secrets.

Source

pub fn secrets(&self, epoch: u64) -> Option<&Key>

The secrets key with this number.

Source

pub fn secrets_keys(&self) -> impl Iterator<Item = (u64, &Key)>

The secrets keys, with their numbers, while the secrets are unlocked.

Source

pub fn write_secrets_with(&mut self, epoch: Option<u64>)

Seals new secret values with the secrets key of this number from now on, or with the one of the highest number if None or if there is no key of this number. A replica seals with the newest secrets key whose rotation knew of every departure, which the numbers, random ones, do not tell.

Source

pub fn newest_secrets(&self) -> Option<(u64, &Key)>

The secrets key that new secret values are sealed with, with its number, if the replica holds one: the one SpaceKeys::write_secrets_with chose, or else the one of the highest number.

Trait Implementations§

Source§

impl Clone for SpaceKeys

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SpaceKeys

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<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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, 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.