mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
reorganize into separate crates
- taskchampion -- core implementation of a replica - taskchampion-cli -- command-line interface - taskchampion-sync-server -- server implementation (not much yet!)
This commit is contained in:
parent
2830043e13
commit
779a331003
36 changed files with 349 additions and 154 deletions
20
taskchampion/src/server.rs
Normal file
20
taskchampion/src/server.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
pub type Blob = Vec<u8>;
|
||||
|
||||
pub enum VersionAdd {
|
||||
// OK, version added
|
||||
Ok,
|
||||
// Rejected, must be based on the the given version
|
||||
ExpectedVersion(u64),
|
||||
}
|
||||
|
||||
/// A value implementing this trait can act as a server against which a replica can sync.
|
||||
pub trait Server {
|
||||
/// Get a vector of all versions after `since_version`
|
||||
fn get_versions(&self, username: &str, since_version: u64) -> Vec<Blob>;
|
||||
|
||||
/// Add a new version. If the given version number is incorrect, this responds with the
|
||||
/// appropriate version and expects the caller to try again.
|
||||
fn add_version(&mut self, username: &str, version: u64, blob: Blob) -> VersionAdd;
|
||||
|
||||
fn add_snapshot(&mut self, username: &str, version: u64, blob: Blob);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue