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
impl OperationSteps
Sourcepub fn administer(
&self,
sql: &SqlContext<'_, '_>,
change: StoreChange,
) -> Result<Option<OperationId>, SyncError>
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.
Sourcepub fn replace_member_keys_for(
&self,
sql: &SqlContext<'_, '_>,
member: MemberId,
keys: MemberPublicKeys,
) -> Result<Option<OperationId>, SyncError>
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).
Sourcepub fn remove_circle_member(
&self,
sql: &SqlContext<'_, '_>,
circle: CircleId,
member: MemberId,
) -> Result<Option<OperationId>, SyncError>
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.
Sourcepub fn create_circle(
&self,
sql: &SqlContext<'_, '_>,
name: String,
) -> Result<(CircleId, OperationId), SyncError>
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
impl OperationSteps
Sourcepub fn new(
device: DeviceId,
identity: Arc<KeySession<MemberIdentity>>,
ids: IdSourceRef,
clock: ClockRef,
directory: StoreDir,
credentials: Arc<DeviceCredentials>,
waits: Arc<RetryWaits>,
state: Arc<SequenceState>,
) -> Self
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.
Sourcepub fn remove_device(
&self,
sql: &SqlContext<'_, '_>,
device: DeviceId,
) -> Result<(Option<OperationId>, Option<ProviderSignOut>), SyncError>
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).
Sourcepub fn create_invite(
&self,
sql: &SqlContext<'_, '_>,
invite: NewInvite,
) -> Result<(InviteId, MemberId, OperationId), SyncError>
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.
Sourcepub fn approve_join_request(
&self,
sql: &SqlContext<'_, '_>,
request: &JoinRequest,
) -> Result<OperationId, SyncError>
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.
Sourcepub fn decline_join_request(
&self,
sql: &SqlContext<'_, '_>,
request: &JoinRequest,
) -> Result<(), SyncError>
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.
Sourcepub fn cancel_invite(
&self,
sql: &SqlContext<'_, '_>,
invite: InviteId,
) -> Result<(), SyncError>
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.
Sourcepub fn add_device(
&self,
sql: &SqlContext<'_, '_>,
key: Option<S3Credentials>,
) -> Result<AddDevice, SyncError>
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.
Sourcepub fn approve_add_device(
&self,
sql: &SqlContext<'_, '_>,
request: &AddDeviceRequest,
) -> Result<(), SyncError>
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.
Sourcepub fn decline_add_device(
&self,
sql: &SqlContext<'_, '_>,
request: &AddDeviceRequest,
) -> Result<(), SyncError>
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.
Sourcepub fn end_add_device(
&self,
sql: &SqlContext<'_, '_>,
pairing: AddDeviceId,
) -> Result<(), SyncError>
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.
Sourcepub fn retry_pending_operation(
&self,
sql: &SqlContext<'_, '_>,
id: OperationId,
) -> Result<(), SyncError>
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§
impl !RefUnwindSafe for OperationSteps
impl !UnwindSafe for OperationSteps
impl Freeze for OperationSteps
impl Send for OperationSteps
impl Sync for OperationSteps
impl Unpin for OperationSteps
impl UnsafeUnpin for OperationSteps
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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