pub struct Replica { /* private fields */ }Expand description
A running seed: the home it copies, the credential it copies with, and the platform it copies into.
Implementations§
Source§impl Replica
impl Replica
Sourcepub fn new(
root: PathBuf,
home: Home,
credential: Credential,
platform: Arc<Platform>,
) -> Self
pub fn new( root: PathBuf, home: Home, credential: Credential, platform: Arc<Platform>, ) -> Self
A seed of home, writing into platform and fetching git into
the bare repositories under root.
platform should have been made a seed of the same home with
Platform::as_seed_of; contact is how both learn it. If it
was not, it is made one here, since a platform being replicated
into is a seed whether or not anybody said so.
Sourcepub fn fetch_signers(&self) -> Result<usize, ReplicaError>
pub fn fetch_signers(&self) -> Result<usize, ReplicaError>
Re-reads the home’s signer table into this seed’s registry, and checks the home still signs with the pinned key.
§Errors
ReplicaError::Unreachable when the table cannot be read, and
ReplicaError::Halted when the home’s key is not the pinned one.
Sourcepub fn statements(&self) -> Vec<SignedStatement>
pub fn statements(&self) -> Vec<SignedStatement>
The statements this seed has signed, oldest first.
Sourcepub fn fetch_objects(&self, repo: &str) -> Result<RefCheck, String>
pub fn fetch_objects(&self, repo: &str) -> Result<RefCheck, String>
Fetches repo’s objects and refs from the home into the bare
repository here, then checks every ref the view names for it
against what the repository holds.
§Errors
The name is not a repository path, or git could not create or fetch into the repository.
Sourcepub fn replicate_once(&self) -> Result<Progress, ReplicaError>
pub fn replicate_once(&self) -> Result<Progress, ReplicaError>
One round: the signer table, every log page the home has past this
seed’s head, then the git objects for every repository the view
names. The daemon runs this every INTERVAL_SECS; tests call it
directly.
§Errors
See ReplicaError. A halt is recorded in Replica::status and
every later round returns it without contacting the home.