Skip to main content

OperationSteps

Struct OperationSteps 

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

The steps of the app’s write that journal an operation (§4, §11.1): checked against the state this device has applied, journaled with or without storage, and run by a later pass. One per writer handle.

Implementations§

Source§

impl OperationSteps

Source

pub fn administer( &self, sql: &SqlContext<'_, '_>, change: StoreChange, ) -> Result<Option<OperationId>, SyncError>

Journal an administrative change as a step of a write: renaming the store, changing a role, removing a member or a device, and renaming, deleting or changing the members of a circle. None when the applied state already has what it asks for: nothing is journaled. A change the applied state refuses fails the step with Rejected. Once the write commits, a pass is asked for, which runs the operation as soon as storage is connected.

Source

pub fn replace_member_keys_for( &self, sql: &SqlContext<'_, '_>, member: MemberId, keys: MemberPublicKeys, ) -> Result<Option<OperationId>, SyncError>

Journal the replacement of another member’s public pair with keys, as a step of a write, expecting the pair the applied state binds to them now (§10.1, §12.3). A target that is this device’s own member fails with Rejected(NotAllowed): replacing one’s own pair is replace_member_keys. A removed or unknown member fails with Rejected(TargetGone).

Source

pub fn remove_circle_member( &self, sql: &SqlContext<'_, '_>, circle: CircleId, member: MemberId, ) -> Result<Option<OperationId>, SyncError>

Journal removing member from circle as a step of a write, with the circle’s replacement key: the pass keeps the key in custody, claims a copy of it for each member who stays, then claims the removal, whose entry introduces it (§15.8). None when the applied state has the member out of the circle already; a removal it refuses fails the step with Rejected.

Source

pub fn create_circle( &self, sql: &SqlContext<'_, '_>, name: String, ) -> Result<(CircleId, OperationId), SyncError>

Journal making a circle, with this device’s member as its first member, as a step of a write, and return the new circle’s id with the operation’s (§15.5). Any active member of the store may make one; the pass keeps the circle’s first key in custody, then claims its copy and its introduction. The app can write rows into the circle once its slot applies. A name that isn’t a valid name fails with Format.

Source§

impl OperationSteps

Source

pub fn new( device: DeviceId, identity: Arc<KeySession<MemberIdentity>>, ids: IdSourceRef, clock: ClockRef, directory: StoreDir, credentials: Arc<DeviceCredentials>, waits: Arc<RetryWaits>, state: Arc<SequenceState>, ) -> Self

Compose where the writer handle is made.

Source

pub fn remove_device( &self, sql: &SqlContext<'_, '_>, device: DeviceId, ) -> Result<(Option<OperationId>, Option<ProviderSignOut>), SyncError>

Journal a device’s removal as a step of an app’s write, and say how its member signs out of the provider, if anything is left to do there, from the recorded location (§14.2).

Source

pub fn create_invite( &self, sql: &SqlContext<'_, '_>, invite: NewInvite, ) -> Result<(InviteId, MemberId, OperationId), SyncError>

Make an invite, as a step of a write (§13.2), and return its id, the member id it fixes and its operation. The write checks the invite against the slots this device has applied, then journals it, with or without storage; the invite is listed in coven_invites from its commit, without a code. Once the write commits, a pass is asked for, which checks the invite again against the history it catches up with, grants its storage access and fixes its code. A check that fails there, or a failed grant, is the invite’s pending record in coven_pending, under its operation; the app cancels the invite to end it. The invite expires after its lifetime by this device’s clock, from now. The invite is made at the store’s recorded location; a store with none fails with NoStorage.

Made by a device that isn’t a registered admin, the step fails with Rejected(NotAllowed); for a replacement of a member who isn’t active, with Rejected(TargetGone), and of this device’s own member, with Rejected(NotAllowed). A name that isn’t one fails with Format, and access that doesn’t fit the location with its storage failure.

Source

pub fn approve_join_request( &self, sql: &SqlContext<'_, '_>, request: &JoinRequest, ) -> Result<OperationId, SyncError>

Approve exactly this checked request, as a step of a write (§13.2), and return the operation that binds its pair: the write journals it, and the invite’s approval begins, with or without storage. Once the write commits, a pass is asked for, which catches up and claims one admission: the entry admitting the member with the request’s pair, or rebinding their pair, and registering the request’s device, carrying copies of every store key and the held circle keys for that pair; once begun, approval finishes. The operation’s outcome is listed in coven_operations: a rejection ends the invite as a decline does. The step doesn’t check the approval against the applied state, so the app is never refused an approval it was shown as waiting: one the history refuses, as when this admin was demoted, is refused by the pass, as its binding’s outcome. A request the invite no longer shows, and an invite whose lifetime ended, fail the step with InvitationChanged.

Source

pub fn decline_join_request( &self, sql: &SqlContext<'_, '_>, request: &JoinRequest, ) -> Result<(), SyncError>

Decline an invite’s checked request, as a step of a write (§13.2): the write ends the invite, which takes it out of coven_invites, with or without storage. Once the write commits, a pass is asked for, which deletes the request, so the requester’s join ends as declined, and takes back the access the invite granted. A request the invite no longer shows, an invite whose approval has begun, and one whose lifetime ended fail the step with InvitationChanged.

Source

pub fn cancel_invite( &self, sql: &SqlContext<'_, '_>, invite: InviteId, ) -> Result<(), SyncError>

Cancel an invite before anyone joins with it, as a step of a write (§13.2): the write ends the invite, which takes it out of coven_invites, with or without storage. Once the write commits, a pass is asked for, which deletes a waiting request, so the requester’s join ends as declined, and takes back the access the invite granted. An invite whose approval has begun, and one whose lifetime ended, fail the step with InvitationChanged.

Source

pub fn add_device( &self, sql: &SqlContext<'_, '_>, key: Option<S3Credentials>, ) -> Result<AddDevice, SyncError>

Make a pairing, as a step of a write (§13.2): the write checks that this device is registered and its member active in the slots it has applied, fixes the pairing’s codes and journals it, with or without storage. key is the S3 key this device connects with, which an S3 pairing’s QR code carries; one without it fails with InvalidConfiguration. Once the write commits, a pass is asked for, which looks for the pairing’s request.

Source

pub fn approve_add_device( &self, sql: &SqlContext<'_, '_>, request: &AddDeviceRequest, ) -> Result<(), SyncError>

Approve exactly this checked request, as a step of a write (§13.2): request is the one the app was shown, which the pairing compares with the one it holds before it seals the member’s current private pair to that request’s sealing key and journals the handover. Once the write commits, a pass is asked for, which puts the handover in the request’s place. A request the pairing no longer shows, and a pairing whose lifetime ended, fail the step with InvitationChanged.

Source

pub fn decline_add_device( &self, sql: &SqlContext<'_, '_>, request: &AddDeviceRequest, ) -> Result<(), SyncError>

Decline exactly this checked request, as a step of a write (§13.2): the pairing ends as declined, and a pass is asked for, which puts the marker in the request’s place. A request the pairing no longer shows, an approved pairing, and one whose lifetime ended, fail the step with InvitationChanged.

Source

pub fn end_add_device( &self, sql: &SqlContext<'_, '_>, pairing: AddDeviceId, ) -> Result<(), SyncError>

The screen showing the pairing’s code closed, as a step of a write (§13.2): the pairing ends at whatever stage it is and is forgotten once a pass has put the marker in the place of its request or handover. A pairing that has ended is forgotten as it is; one already forgotten changes nothing.

Source

pub fn retry_pending_operation( &self, sql: &SqlContext<'_, '_>, id: OperationId, ) -> Result<(), SyncError>

Make an operation due now, as a step of a write (E6): its pending record and retry wait end in the write’s transaction. It cannot resurrect an invalidated action, or one that waits for an update not installed yet, and it can’t bypass a provider cooldown or the stuck-device rule. Once the write commits, the operation’s wait ends in this session too, and a pass is asked for to run it.

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
§

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

§

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

§

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.

§

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

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

§

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
§

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
§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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