1 unstable release
0.0.1 | Feb 22, 2022 |
---|
#53 in #merkle
Used in transparentlog_rocksdb
37KB
737 lines
Transparent log Core library
A Rust implementation of Transparent Logs for Skeptical Clients (https://research.swtch.com/tlog).
Currently doesn't implement tiling.
Backends provided by the core library:
- In-memory
- Raw files
There is also a simple client with in-memory caching.
fn main() -> anyhow::Result<()> {
// Create a new log
let mut ml: InMemoryLog<String>=InMemoryLog::default();
// Create a new client
let mut client= InMemoryLogClientBuilder::new(&ml)?.build();
// Append a record to the log
let rec1 = ml.append(String::from("entry1"))?;
// Check the log contains the record
assert_eq!(true, check_record(&mut client,&ml,&rec1)?);
// Get back the data
assert_eq!("entry1",ml.get(rec1.id)?.unwrap().as_str());
Ok(())
}
lib.rs
:
Transparent Log
This crate provides an implementation of a Merkle tree for log records, for sceptical clients.
See https://research.swtch.com/tlog
Examples
use transparentlog_core::{check_record,InMemoryLog,InMemoryLogClientBuilder,TransparentLog};
// Create a new log
let mut ml: InMemoryLog<String>=InMemoryLog::default();
// Create a new client
let mut client= InMemoryLogClientBuilder::new(&ml)?.build();
// Append a record to the log
let rec1 = ml.append(String::from("entry1"))?;
// Check the log contains the record
assert_eq!(true, check_record(&mut client,&ml,&rec1)?);
// Get back the data
assert_eq!("entry1",ml.get(rec1.id)?.unwrap().as_str());
Dependencies
~5.5MB
~92K SLoC