Skip to main content

Replica

Struct Replica 

Source
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

Source

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.

Source

pub fn home(&self) -> &Home

The home this seed copies.

Source

pub fn status(&self) -> Status

Where replication stands.

Source

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.

Source

pub fn statements(&self) -> Vec<SignedStatement>

The statements this seed has signed, oldest first.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.