Skip to main content

StoreState

Struct StoreState 

Source
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

Source

pub fn active_member(&self, id: &MemberId) -> Option<&StoreMember>

The member, unless a kept removal removed it.

Source

pub fn device_acts_for(&self, device: &DeviceId, member: &MemberId) -> bool

Whether device is installed and active, and belongs to member.

Source

pub fn active_admin(&self, id: &MemberId) -> bool

Whether id is a member who has not been removed and holds the admin role.

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

pub fn deleted(&self, audience: &Audience) -> bool

Whether audience is a deleted circle (§15.9).

Source

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

Source§

fn clone(&self) -> StoreState

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for StoreState

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for StoreState

Source§

fn default() -> StoreState

Returns the “default value” for a type. Read more
Source§

impl PartialEq for StoreState

Source§

fn eq(&self, other: &StoreState) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for StoreState

Source§

impl StructuralPartialEq for StoreState

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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