coven/builder_joining.rs
1//! The app's joining write on the builder (E1).
2
3use super::*;
4
5/// The app's joining write, as the builder keeps it.
6pub(super) type JoiningHook =
7 dyn Fn(&JoiningWrite<'_>, &Joining) -> Result<(), DbError> + Send + Sync;
8
9impl CovenBuilder {
10 /// The app's write for a member's device as its registration applies
11 /// (E1): it runs in the transaction that first applies the registration
12 /// of one of this person's devices, on slot 1 as the store is created, a
13 /// join's admission, a snapshot that covers it, a restore, a pairing or a
14 /// reset's installation, as a local write whose `read_through` is the
15 /// slot that transaction applies through. It reads the store as that
16 /// transaction leaves it, with the facts of its member's latest admission
17 /// or, for the store's creator, of slot 1 (`Joining`), and runs on every
18 /// device of the member once each, so the app writes it to change
19 /// nothing a second time. An error fails the transaction: the slot
20 /// doesn't apply, the pass reports it, and the next pass tries again.
21 /// Without one, nothing runs.
22 pub fn joining_write<F>(mut self, write: F) -> Self
23 where
24 F: Fn(&JoiningWrite<'_>, &Joining) -> Result<(), DbError> + Send + Sync + 'static,
25 {
26 self.joining_write = Some(Arc::new(write));
27 self
28 }
29}