tc-transact

Crates.iotc-transact
lib.rstc-transact
version0.21.1
sourcesrc
created_at2021-02-21 01:46:48.143321
updated_at2024-08-15 20:08:22.787159
descriptionTraits and locking utilities for a TinyChain transaction.
homepage
repositoryhttps://github.com/haydnv/tinychain.git
max_upload_size
id358299
size82,157
Haydn Vestal (haydnv)

documentation

README

This crate is used internally by TinyChain. It provides traits and data structures to support transactional mutations of in-memory and persistent datatypes.

Example:

use tc_transact::{TxnId, TxnLock};

let version = TxnLock::new("version", 0);

let txn_one = TxnId::new(1);
let txn_two = TxnId::new(2);
let txn_three = TxnId::new(3);

assert_eq!(version.read(txn_one).await.unwrap(), 0);

*(version.write(txn_two).await.unwrap()) = 2;
version.commit(txn_two).await;

assert_eq!(version.read(txn_three).await.unwrap(), 2);

For more information on TinyChain, see http://github.com/haydnv/tinychain

Commit count: 3128

cargo fmt