pub struct Records { /* private fields */ }Expand description
The records of the sync role, in sync.sqlite beside its lock, encrypted under a key of
the replica’s: who holds the role, what other programs ask it, and what it did.
Implementations§
Source§impl Records
impl Records
Sourcepub fn holder(&self) -> Result<Option<HolderRecord>, NodeError>
pub fn holder(&self) -> Result<Option<HolderRecord>, NodeError>
Who holds the role, as it recorded, if any program does: a record that a program left as it ended, as by a crash or as an app quits, says nothing once its lock is free.
§Errors
Returns an error if the database cannot be read, or the lock’s file opened.
Sourcepub fn ask(&self, replica: Option<EntityId>, at: u64) -> Result<i64, NodeError>
pub fn ask(&self, replica: Option<EntityId>, at: u64) -> Result<i64, NodeError>
Asks the holder to sync with one replica, or with all it finds: returns the ask,
whose answer Records::answered tells.
§Errors
Returns an error if the database cannot be written.
Sourcepub fn round(&self) -> Result<Option<Round>, NodeError>
pub fn round(&self) -> Result<Option<Round>, NodeError>
Where the round of checks under way stands, if one began (technical design: checking and repair).
§Errors
Returns an error if the database cannot be read.
Sourcepub fn answered(&self, ask: i64) -> Result<Option<u64>, NodeError>
pub fn answered(&self, ask: i64) -> Result<Option<u64>, NodeError>
When the holder answered an ask, if it did: once the sync with those of the replicas asked for that it found on the network ended, whose records then say how it went.
§Errors
Returns an error if the database cannot be read.
Sourcepub fn replicas(&self) -> Result<BTreeMap<EntityId, ReplicaRecord>, NodeError>
pub fn replicas(&self) -> Result<BTreeMap<EntityId, ReplicaRecord>, NodeError>
What the holder recorded of each other replica. Only a holder that runs knows which are on the network: once its lock is free, none is, whatever it left recorded.
§Errors
Returns an error if the database cannot be read, or the lock’s file opened.
Sourcepub fn synced_since(
&self,
asked: u64,
) -> Result<BTreeMap<EntityId, ReplicaRecord>, NodeError>
pub fn synced_since( &self, asked: u64, ) -> Result<BTreeMap<EntityId, ReplicaRecord>, NodeError>
What the holder recorded of each replica that it synced with at asked or later, by
the wall clock, as in answer to an ask made then: a sync recorded before was not the
one asked for.
§Errors
Returns an error if the database cannot be read.
Sourcepub fn holds(&self, at: u64) -> Result<BTreeSet<Hash>, NodeError>
pub fn holds(&self, at: u64) -> Result<BTreeSet<Hash>, NodeError>
The sealed blobs that this replica holds for others at at, as it proved them.
§Errors
Returns an error if the database cannot be read.
Sourcepub fn backup_folders(
&self,
) -> Result<BTreeMap<EntityId, FoundBackup>, NodeError>
pub fn backup_folders( &self, ) -> Result<BTreeMap<EntityId, FoundBackup>, NodeError>
The person’s backups that the holder found on this computer: where it last found each, and when it last updated it here, or tried to.
§Errors
Returns an error if the database cannot be read.
Sourcepub fn record_backup(
&self,
backup: EntityId,
folder: &Path,
updated: Option<(u64, usize)>,
) -> Result<(), NodeError>
pub fn record_backup( &self, backup: EntityId, folder: &Path, updated: Option<(u64, usize)>, ) -> Result<(), NodeError>
Records where the holder found a backup, and, if it updated it now or tried to, when, and how many changes the replica kept then.
§Errors
Returns an error if the database cannot be written.