WIP. Secure, distributed, append-only log structure. Adapted from mafintosh/hypercore.
extern crate hypercore;
use hypercore::Feed;
use std::path::PathBuf;
let path = PathBuf::from("./my-first-dataset");
let mut feed = Feed::new(path).unwrap();
feed.append(b"hello").unwrap();
feed.append(b"world").unwrap();
println!("{:?}", feed.get(0)); // prints "hello"
println!("{:?}", feed.get(1)); // prints "world"
let feed = Feed::default();
feed.append(b"data")?;
for event in feed {
match event {
Event::Data(data) => {},
Event::PeerAdd => {},
Event::PeerRemove => {},
Event::Download => {},
Event::Synchronize => {},
Event::Append => {},
}
}
- feed: The main data structure in Hypercore. Append-only log that uses multiple data structures and algorithms to safely store data.
- data: Data that's written to the feed by users.
- keypair: An
Ed25519
key pair used to encrypt data with. - signature: A cryptorgraphic certificate of authenticity for a given piece of code.
- tree: A binary tree mapped as a
flat-tree
to keep an index of the current data. - bitfield: ???
$ cargo add hypercore
MIT OR Apache-2.0