pub struct StoreState {
pub store: Option<StoreIdentity>,
pub members: BTreeMap<MemberId, StoreMember>,
pub bound_keys: BTreeSet<MemberPublicKeys>,
pub devices: BTreeMap<DeviceId, StoreDevice>,
pub circles: BTreeMap<CircleId, StoreCircle>,
pub circle_deletions: BTreeMap<CircleId, Slot>,
pub schema: BTreeMap<Audience, StoreVersion>,
pub resets: BTreeMap<Audience, SnapshotId>,
}Expand description
Store state, including removed identities needed to check older writes (§10.4).
Schema versions belong to each audience: the store’s raise is under
Audience::Store, and each circle has its own. A raise is absent until a
kept raise selects it, as in §18.3; before one, the audience is at its base
(StoreState::reached). These are independent of the local app
migration version returned by crate::Database::schema_version.
Fields§
§store: Option<StoreIdentity>Absent before the first entry creates the store.
members: BTreeMap<MemberId, StoreMember>Every member added by a kept entry, including removed members.
bound_keys: BTreeSet<MemberPublicKeys>Every public pair a kept creation, addition or member-key replacement bound, including pairs of removed members and pairs a later replacement retired. An addition of an id not active in its view, and every replacement, must share no key with these (§10).
devices: BTreeMap<DeviceId, StoreDevice>Every device added by a kept entry, including removed devices.
circles: BTreeMap<CircleId, StoreCircle>Every circle made by a kept entry, including deleted circles.
circle_deletions: BTreeMap<CircleId, Slot>Deleted circles and their deciding slots; absence means no deletion.
schema: BTreeMap<Audience, StoreVersion>The selected schema raise per audience; creation itself carries no raise.
Self::reached gives an audience’s version, a circle’s base included.
resets: BTreeMap<Audience, SnapshotId>The last kept reset of each audience (§19.4).
Implementations§
Source§impl StoreState
impl StoreState
Sourcepub fn active_member(&self, id: &MemberId) -> Option<&StoreMember>
pub fn active_member(&self, id: &MemberId) -> Option<&StoreMember>
The member, unless a kept removal removed it.
Sourcepub fn device_acts_for(&self, device: &DeviceId, member: &MemberId) -> bool
pub fn device_acts_for(&self, device: &DeviceId, member: &MemberId) -> bool
Whether device is installed and active, and belongs to member.
Sourcepub fn active_admin(&self, id: &MemberId) -> bool
pub fn active_admin(&self, id: &MemberId) -> bool
Whether id is a member who has not been removed and holds the admin role.
Sourcepub fn reads_circle(&self, circle: CircleId, member: &MemberId) -> bool
pub fn reads_circle(&self, circle: CircleId, member: &MemberId) -> bool
Whether member remains in the store and in circle, which exists and
is not deleted (§15.5).
Sourcepub fn readable_circles(&self, member: &MemberId) -> BTreeSet<CircleId>
pub fn readable_circles(&self, member: &MemberId) -> BTreeSet<CircleId>
Every circle member reads under Self::reads_circle: the circles
whose parts its devices open, snapshot and reload (§15.6, §16).
Sourcepub fn reached(&self, audience: &Audience) -> u32
pub fn reached(&self, audience: &Audience) -> u32
The schema version audience has reached: the one its latest kept
raise selected, or before any raise its base, zero for the store and
for a circle the breaking version its creation recorded. A raise goes
past the base, so this is the greater of the two (§16.3, §18.3).
Sourcepub fn awaits_raise(&self, audience: &Audience, version: u32) -> bool
pub fn awaits_raise(&self, audience: &Audience, version: u32) -> bool
Whether a part at version in audience waits for a raise: the
audience is below that version and can still be raised. Nobody can
raise a deleted circle, and its parts are taken out wherever they land
(§15.9, §18.5).
Sourcepub fn gone_circle(&self, circle: &CircleId) -> bool
pub fn gone_circle(&self, circle: &CircleId) -> bool
Whether circle is one this state doesn’t hold, or deleted: a change
aimed at it meets a gone target (§10.4, §15.9).
Sourcepub fn deleted(&self, audience: &Audience) -> bool
pub fn deleted(&self, audience: &Audience) -> bool
Whether audience is a deleted circle (§15.9).
Sourcepub fn readable_audiences(&self, member: &MemberId) -> Vec<Audience>
pub fn readable_audiences(&self, member: &MemberId) -> Vec<Audience>
Every audience member reads: the store’s, then each of
Self::readable_circles in id order.
Trait Implementations§
Source§impl Clone for StoreState
impl Clone for StoreState
Source§fn clone(&self) -> StoreState
fn clone(&self) -> StoreState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StoreState
impl Debug for StoreState
Source§impl Default for StoreState
impl Default for StoreState
Source§fn default() -> StoreState
fn default() -> StoreState
Source§impl PartialEq for StoreState
impl PartialEq for StoreState
impl Eq for StoreState
impl StructuralPartialEq for StoreState
Auto Trait Implementations§
impl Freeze for StoreState
impl RefUnwindSafe for StoreState
impl Send for StoreState
impl Sync for StoreState
impl Unpin for StoreState
impl UnsafeUnpin for StoreState
impl UnwindSafe for StoreState
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.