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
impl SpaceKeys
Sourcepub fn new(epoch: u64, key: Key) -> Self
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.
Sourcepub fn write_with(&mut self, epoch: Option<u64>)
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.
Sourcepub fn writing_with(&self, epoch: u64) -> Self
pub fn writing_with(&self, epoch: u64) -> Self
The same keys, wrapping new changes with the key of this number, if there is one.
Sourcepub fn epochs(&self) -> impl Iterator<Item = u64> + '_
pub fn epochs(&self) -> impl Iterator<Item = u64> + '_
The numbers of the space keys, in order.
Sourcepub fn space_keys(&self) -> impl Iterator<Item = (u64, &Key)>
pub fn space_keys(&self) -> impl Iterator<Item = (u64, &Key)>
The space keys with their numbers, in order.
Sourcepub fn insert(&mut self, epoch: u64, key: Key)
pub fn insert(&mut self, epoch: u64, key: Key)
Adds a space key, after the space’s key has changed.
Sourcepub fn newest(&self) -> (u64, &Key)
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.
Sourcepub fn insert_secrets(&mut self, epoch: u64, key: Key)
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.
Sourcepub fn forget_secrets(&mut self)
pub fn forget_secrets(&mut self)
Forgets the secrets keys, when the replica locks its secrets.
Sourcepub fn secrets_keys(&self) -> impl Iterator<Item = (u64, &Key)>
pub fn secrets_keys(&self) -> impl Iterator<Item = (u64, &Key)>
The secrets keys, with their numbers, while the secrets are unlocked.
Sourcepub fn write_secrets_with(&mut self, epoch: Option<u64>)
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.
Sourcepub fn newest_secrets(&self) -> Option<(u64, &Key)>
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.