Crate hypercore[−][src]
hypercore
[][2] [
][4]
[
][6] [
]8
WIP. Secure, distributed, append-only log structure. Adapted from mafintosh/hypercore.
Usage
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"
Networking Vaporware API
ⓘThis example is not tested
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 => {}, } }
Data Structures
- 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
Ed25519key 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-treeto keep an index of the current data. - bitfield: ???
Installation
$ cargo add hypercore
License
MIT OR Apache-2.0
Re-exports
pub use feed::Feed; |
pub use storage::Storage; |
pub use storage::Store; |
Modules
| bitfield |
Bitfield module. Exposes |
| crypto |
Cryptographic functions. |
| feed |
Hypercore's main abstraction. Exposes an append-only, secure log structure. |
| prelude |
Convenience wrapper to import all of Hypercore's core. |
| storage |
Save data to a desired storage backend. |
Structs
| FeedBuilder |
Construct a new |
| Keypair |
An ed25519 keypair. |
| Node |
Nodes that are persisted to disk. |
Traits
| NodeTrait |
Functions that need to be implemented for the Data that |