[−][src]Trait taskchampion::taskstorage::TaskStorageTxn
A TaskStorage transaction, in which storage operations are performed.
Concurrency
Serializable consistency must be maintained. Concurrent access is unusual and some implementations may simply apply a mutex to limit access to one transaction at a time.
Commiting and Aborting
A transaction is not visible to other readers until it is committed with
crate::taskstorage::TaskStorageTxn::commit
. Transactions are aborted if they are dropped.
It is safe and performant to drop transactions that did not modify any data without committing.
Required methods
pub fn get_task(&mut self, uuid: &Uuid) -> Fallible<Option<TaskMap>>
[src]
Get an (immutable) task, if it is in the storage
pub fn create_task(&mut self, uuid: Uuid) -> Fallible<bool>
[src]
Create an (empty) task, only if it does not already exist. Returns true if the task was created (did not already exist).
pub fn set_task(&mut self, uuid: Uuid, task: TaskMap) -> Fallible<()>
[src]
Set a task, overwriting any existing task. If the task does not exist, this implicitly
creates it (use get_task
to check first, if necessary).
pub fn delete_task(&mut self, uuid: &Uuid) -> Fallible<bool>
[src]
Delete a task, if it exists. Returns true if the task was deleted (already existed)
pub fn all_tasks(&mut self) -> Fallible<Vec<(Uuid, TaskMap)>>
[src]
Get the uuids and bodies of all tasks in the storage, in undefined order.
pub fn all_task_uuids(&mut self) -> Fallible<Vec<Uuid>>
[src]
Get the uuids of all tasks in the storage, in undefined order.
pub fn base_version(&mut self) -> Fallible<VersionId>
[src]
Get the current base_version for this storage -- the last version synced from the server.
pub fn set_base_version(&mut self, version: VersionId) -> Fallible<()>
[src]
Set the current base_version for this storage.
pub fn operations(&mut self) -> Fallible<Vec<Operation>>
[src]
Get the current set of outstanding operations (operations that have not been sync'd to the server yet)
pub fn add_operation(&mut self, op: Operation) -> Fallible<()>
[src]
Add an operation to the end of the list of operations in the storage. Note that this merely stores the operation; it is up to the TaskDB to apply it.
pub fn set_operations(&mut self, ops: Vec<Operation>) -> Fallible<()>
[src]
Replace the current list of operations with a new list.
pub fn get_working_set(&mut self) -> Fallible<Vec<Option<Uuid>>>
[src]
Get the entire working set, with each task UUID at its appropriate (1-based) index. Element 0 is always None.
pub fn add_to_working_set(&mut self, uuid: &Uuid) -> Fallible<usize>
[src]
Add a task to the working set and return its (one-based) index. This index will be one greater than the highest used index.
pub fn clear_working_set(&mut self) -> Fallible<()>
[src]
Clear all tasks from the working set in preparation for a garbage-collection operation. Note that this is the only way items are removed from the set.
pub fn commit(&mut self) -> Fallible<()>
[src]
Commit any changes made in the transaction. It is an error to call this more than once.