pub struct Replica { /* private fields */ }Expand description
One workspace root and its replica store.
Implementations§
Source§impl Replica
impl Replica
pub fn open(config: ReplicaConfig, clock: Arc<dyn Clock>) -> Result<Self>
pub fn replica_id(&self) -> ReplicaId
pub fn vv(&self) -> &VersionVector
pub fn config(&self) -> &ReplicaConfig
pub fn state(&self, path: &str) -> Result<Option<PathState>>
pub fn states(&self) -> Result<Vec<(String, PathState)>>
Sourcepub fn pause_reason(&self) -> Result<Option<PauseReason>>
pub fn pause_reason(&self) -> Result<Option<PauseReason>>
Why this replica must not scan or apply right now. A root or marker that is missing while files were written would otherwise read as “everything deleted”.
Sourcepub fn scan(&mut self) -> Result<ScanOutcome>
pub fn scan(&mut self) -> Result<ScanOutcome>
Record every unrecorded edit under the root and finish pending writes.
Sourcepub fn delta_for(&self, peer: &VersionVector) -> Result<Vec<PathUpdate>>
pub fn delta_for(&self, peer: &VersionVector) -> Result<Vec<PathUpdate>>
Path states the peer with version vector peer has not merged.
Sourcepub fn apply(
&mut self,
updates: &[PathUpdate],
source: &dyn ContentSource,
) -> Result<Report>
pub fn apply( &mut self, updates: &[PathUpdate], source: &dyn ContentSource, ) -> Result<Report>
Join updates received from a peer, fetching content from source.
Sourcepub fn commit_session(&mut self, peer: &VersionVector) -> Result<()>
pub fn commit_session(&mut self, peer: &VersionVector) -> Result<()>
Declare that every update of a session with peer has been applied.
Sourcepub fn fetch_missing(&mut self, source: &dyn ContentSource) -> Result<Report>
pub fn fetch_missing(&mut self, source: &dyn ContentSource) -> Result<Report>
Retry writes that were waiting for content.
Sourcepub fn read_content(&self, hash: &ContentHash) -> Result<Option<Vec<u8>>>
pub fn read_content(&self, hash: &ContentHash) -> Result<Option<Vec<u8>>>
Bytes with hash from a file on disk or the staging directory.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Replica
impl !UnwindSafe for Replica
impl Freeze for Replica
impl Send for Replica
impl Sync for Replica
impl Unpin for Replica
impl UnsafeUnpin for Replica
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more