pub struct PrincipalActivity { /* private fields */ }Expand description
The stamps, in memory, written to the control database in batches. See the module.
Implementations§
Source§impl PrincipalActivity
impl PrincipalActivity
Sourcepub fn in_memory() -> PrincipalActivity
pub fn in_memory() -> PrincipalActivity
Stamps kept in memory only (a test, a tool).
Sourcepub fn open(
db: Arc<ControlDb>,
legacy_json: Option<PathBuf>,
log: Option<Arc<Log>>,
) -> PrincipalActivity
pub fn open( db: Arc<ControlDb>, legacy_json: Option<PathBuf>, log: Option<Arc<Log>>, ) -> PrincipalActivity
The stamps kept in db’s principal_activity table, read back — and,
the first time, the old ACTIVITY_FILE at legacy_json read into
it (the file is left). A table that cannot be read, or a file that does
not parse, is said at warn! and started over: this is bookkeeping,
and a box must never refuse to start over it.
Sourcepub fn signed_in(&self, principal_id: &str, now: i64)
pub fn signed_in(&self, principal_id: &str, now: i64)
A console session was issued to principal_id at now.
Sourcepub fn operated(&self, principal_id: &str, now: i64)
pub fn operated(&self, principal_id: &str, now: i64)
principal_id made a call that changed something at now.
Sourcepub fn flush(&self) -> Result<bool>
pub fn flush(&self) -> Result<bool>
Write the rows that moved since the last flush: one Activity
frame for all of them (on a box that originates its log), then one
redb write transaction. Ok(false) when nothing moved (nothing is
written or framed) or this record keeps no database. A refused write
keeps the rows for the next flush.
Sourcepub fn absorb(&self, rows: BTreeMap<String, Seen>) -> Result<()>
pub fn absorb(&self, rows: BTreeMap<String, Seen>) -> Result<()>
Take stamps from the primary (a twin applying an Activity frame or a
snapshot item; a box being restored): each one merged in memory, the later
of each stamp kept, and the merged rows written to the table in one
transaction. Framed by nobody — it is already a frame.