From de03209285351011bf02193f758b37279a680f81 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Sun, 29 Nov 2020 21:26:39 -0500 Subject: [PATCH] bits of docs --- taskchampion/src/lib.rs | 2 +- taskchampion/src/replica.rs | 14 ++++++++++++++ taskchampion/src/server/mod.rs | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/taskchampion/src/lib.rs b/taskchampion/src/lib.rs index aa2c8bf99..64c6cb238 100644 --- a/taskchampion/src/lib.rs +++ b/taskchampion/src/lib.rs @@ -18,7 +18,7 @@ The [`server`](crate::server) module defines the interface a server must meet. # See Also -See the [TaskChampion Book](https://github.com/djmitche/taskchampion/blob/main/docs/src/SUMMARY.md) +See the [TaskChampion Book](http://djmitche.github.com/taskchampion) for more information about the design and usage of the tool. */ diff --git a/taskchampion/src/replica.rs b/taskchampion/src/replica.rs index 34e3b6f31..1de446e26 100644 --- a/taskchampion/src/replica.rs +++ b/taskchampion/src/replica.rs @@ -12,6 +12,18 @@ use uuid::Uuid; /// A replica represents an instance of a user's task data, providing an easy interface /// for querying and modifying that data. +/// +/// ## Tasks +/// +/// Tasks are uniquely identified by UUIDs. +/// Most task modifications are performed via the [`crate::Task`] and [`crate::TaskMut`] types. +/// +/// ## Working Set +/// +/// A replica maintains a "working set" of tasks that are of current concern to the user, +/// specifically pending tasks. These are indexed with small, easy-to-type integers. Newly +/// pending tasks are automatically added to the working set, and the working set is "renumbered" +/// during the garbage-collection process. pub struct Replica { taskdb: TaskDB, } @@ -23,6 +35,8 @@ impl Replica { } } + /// Construct a new replica from a configuration object. This is the common way + /// to create a new object. pub fn from_config(config: ReplicaConfig) -> Fallible { let storage = Box::new(KVStorage::new(config.taskdb_dir)?); Ok(Replica::new(storage)) diff --git a/taskchampion/src/server/mod.rs b/taskchampion/src/server/mod.rs index 341428130..936e441d8 100644 --- a/taskchampion/src/server/mod.rs +++ b/taskchampion/src/server/mod.rs @@ -12,6 +12,7 @@ pub use local::LocalServer; pub use remote::RemoteServer; pub use types::*; +/// Create a new server based on the given configuration. pub fn from_config(config: ServerConfig) -> Fallible> { Ok(match config { ServerConfig::Local { server_dir } => Box::new(LocalServer::new(server_dir)?),