Trait taskchampion::server::Server

source ·
pub trait Server {
    // Required methods
    fn add_version(
        &mut self,
        parent_version_id: VersionId,
        history_segment: HistorySegment
    ) -> Result<(AddVersionResult, SnapshotUrgency), Error>;
    fn get_child_version(
        &mut self,
        parent_version_id: VersionId
    ) -> Result<GetVersionResult, Error>;
    fn add_snapshot(
        &mut self,
        version_id: VersionId,
        snapshot: Snapshot
    ) -> Result<(), Error>;
    fn get_snapshot(&mut self) -> Result<Option<(VersionId, Snapshot)>, Error>;
}
Expand description

A value implementing this trait can act as a server against which a replica can sync.

Required Methods§

source

fn add_version( &mut self, parent_version_id: VersionId, history_segment: HistorySegment ) -> Result<(AddVersionResult, SnapshotUrgency), Error>

Add a new version.

This must ensure that the new version is the only version with the given parent_version_id, and that all versions form a single parent-child chain. Inductively, this means that if there are any versions on the server, then parent_version_id must be the only version that does not already have a child.

source

fn get_child_version( &mut self, parent_version_id: VersionId ) -> Result<GetVersionResult, Error>

Get the version with the given parent VersionId

source

fn add_snapshot( &mut self, version_id: VersionId, snapshot: Snapshot ) -> Result<(), Error>

Add a snapshot on the server

source

fn get_snapshot(&mut self) -> Result<Option<(VersionId, Snapshot)>, Error>

Implementors§