Crate taskchampion

Crate taskchampion 

Source
Expand description

This crate implements the core of TaskChampion, the replica.

Users of this crate can manipulate a task database using this API, including synchronizing that task database with others via a synchronization server.

Example uses of this crate:

  • user interfaces for task management, such as mobile apps, web apps, or command-line interfaces
  • integrations for task management, such as synchronization with ticket-tracking systems or request forms.

§Replica

A TaskChampion replica is a local copy of a user’s task data. As the name suggests, several replicas of the same data can exist (such as on a user’s laptop and on their phone) and can synchronize with one another.

Replicas are accessed using the Replica type.

§Task Storage

Replicas access the task database via a storage object.

The storage module supports pluggable storage for a replica’s data. An implementation is provided, but users of this crate can provide their own implementation as well.

§Server

Replica synchronization takes place against a server. Create a server with ServerConfig.

The server module defines the interface a server must meet. Several server implementations are included, and users can define their own implementations.

§Example

// Create a new Replica, storing data on disk.
let storage = SqliteStorage::new(
  taskdb_dir,
  AccessMode::ReadWrite,
  true,
).await?;
let mut replica = Replica::new(storage);

// Set up a local, on-disk server.
let server_config = ServerConfig::Local { server_dir };
let mut server = server_config.into_server().await?;

// Sync to that server.
replica.sync(&mut server, true).await?;

§Feature Flags

Support for some optional functionality is controlled by feature flags.

  • server-aws - sync to Amazon Web Services
  • server-gcp - sync to Google Cloud Platform
  • server-sync - sync to the taskchampion-sync-server
  • server-local - sync to a local file
  • sync - enables all of the sync features above
  • storage-indexeddb - store task data in the browser using IndexedDB (WASM only)
  • storage-sqlite - store task data locally in SQLite
  • storage - enables all of the storage features above except storage-indexeddb
  • bundled - activates bundling system libraries like sqlite
  • tls-webpki-roots - use TLS roots bundled with the library, instead of reading them from system configuration.
  • tls-native-roots - use native (system) TLS roots, instead of those bundled with rustls. If both tls-webpki-roots and tls-native-roots are given, tls-native-roots takes precedence. At least one of the tls-*-roots features must be enabled to support any of the HTTPS-based server-* features.

By default, sync, storage, bundled, and tls-webpki-roots are enabled.

§WASM Support

TaskChampion can be built for WASM with the usual WASM tools, such as wasm-pack. Only the following features are supported:

  • server-sync - communicate with the sync server using the Fetch API
  • storage-indexeddb - store task data in the browser using IndexedDB (WASM only)

§See Also

See the TaskChampion Book for more information about the design and usage of the tool.

§Minimum Supported Rust Version (MSRV)

This crate supports Rust version 1.88.0 and higher.

Re-exports§

pub use server::Server;
pub use server::ServerConfig;
pub use storage::sqlite::SqliteStorage;
pub use chrono;

Modules§

server
This module defines the client interface to TaskChampion sync servers.
storage
This module defines the backend storage used by Replica.

Structs§

Annotation
An annotation for a task
DependencyMap
DependencyMap stores information on task dependencies between pending tasks.
Replica
A replica represents an instance of a user’s task data, providing an easy interface for querying and modifying that data.
Tag
A Tag is a descriptor for a task, that is either present or absent, and can be used for filtering. Tags composed of all uppercase letters are reserved for synthetic tags.
Task
A task, with a high-level interface.
TaskData
A task.
Uuid
Re-exported type from the uuid crate, for ease of compatibility for consumers of this crate. A Universally Unique Identifier (UUID).
WorkingSet
A WorkingSet represents a snapshot of the working set from a replica.

Enums§

Error
Errors returned from taskchampion operations
Operation
An Operation defines a single change to the task database, as stored locally in the replica.
Status
The status of a task, as defined by the task data model.

Functions§

utc_timestamp

Type Aliases§

Operations
Operations are a sequence of Operation values, which can be committed in a single transaction with Replica::commit_operations.