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§
sourcefn add_version(
&mut self,
parent_version_id: VersionId,
history_segment: HistorySegment
) -> Result<(AddVersionResult, SnapshotUrgency), Error>
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.
sourcefn get_child_version(
&mut self,
parent_version_id: VersionId
) -> Result<GetVersionResult, Error>
fn get_child_version( &mut self, parent_version_id: VersionId ) -> Result<GetVersionResult, Error>
Get the version with the given parent VersionId
sourcefn add_snapshot(
&mut self,
version_id: VersionId,
snapshot: Snapshot
) -> Result<(), Error>
fn add_snapshot( &mut self, version_id: VersionId, snapshot: Snapshot ) -> Result<(), Error>
Add a snapshot on the server