mirror of
https://github.com/GothenburgBitFactory/taskchampion-sync-server.git
synced 2025-06-26 10:54:29 +02:00
Reorganize the core API (#60)
This commit is contained in:
parent
2b1ad12a79
commit
5ad3b8e8bf
13 changed files with 638 additions and 1813 deletions
|
@ -9,6 +9,7 @@ license = "MIT"
|
|||
[dependencies]
|
||||
uuid.workspace = true
|
||||
anyhow.workspace = true
|
||||
thiserror.workspace = true
|
||||
log.workspace = true
|
||||
env_logger.workspace = true
|
||||
chrono.workspace = true
|
||||
|
|
13
core/src/error.rs
Normal file
13
core/src/error.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
/// An error from the [`crate::Server`] type.
|
||||
///
|
||||
/// This type represents only circumstances outside the realm of the protocol, and not the specific
|
||||
/// results descriebd in the protocol documentation.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum ServerError {
|
||||
/// There is no client with the given ClientId.
|
||||
#[error("No such client")]
|
||||
NoSuchClient,
|
||||
|
||||
#[error(transparent)]
|
||||
Other(#[from] anyhow::Error),
|
||||
}
|
|
@ -7,26 +7,17 @@
|
|||
//! This crate uses an abstract storage backend. Note that this does not implement the
|
||||
//! HTTP-specific portions of the protocol, nor provide any storage implementations.
|
||||
//!
|
||||
//! ## API Methods
|
||||
//! ## Usage
|
||||
//!
|
||||
//! The following API methods are implemented. These methods are documented in more detail in
|
||||
//! the protocol documentation.
|
||||
//!
|
||||
//! * [`add_version`]
|
||||
//! * [`get_child_version`]
|
||||
//! * [`add_snapshot`]
|
||||
//! * [`get_snapshot`]
|
||||
//!
|
||||
//! Each API method takes:
|
||||
//!
|
||||
//! * [`StorageTxn`] to access storage. Methods which modify storage will commit the transaction before returning.
|
||||
//! * [`ServerConfig`] providing basic configuration for the server's behavior.
|
||||
//! * `client_id` and a [`Client`] providing the client metadata.
|
||||
//! To use, create a new [`Server`] instance and call the relevant protocol API methods. The
|
||||
//! arguments and return values correspond closely to the protocol documentation.
|
||||
|
||||
mod error;
|
||||
mod inmemory;
|
||||
mod server;
|
||||
mod storage;
|
||||
|
||||
pub use error::*;
|
||||
pub use inmemory::*;
|
||||
pub use server::*;
|
||||
pub use storage::*;
|
||||
|
|
1057
core/src/server.rs
1057
core/src/server.rs
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue