Crate hypercore[][src]

hypercore

[crates.io version][2] [build status][4] [downloads][6] [docs.rs docs]8

WIP. Secure, distributed, append-only log structure. Adapted from mafintosh/hypercore.

Usage

This example is not tested
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"

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 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: ???

Installation

$ cargo add hypercore

License

MIT OR Apache-2.0

Re-exports

pub use storage::Storage;
pub use storage::Store;

Modules

bitfield

Bitfield module. Exposes {data, tree, index} internally. Serializable to disk.

crypto

Cryptographic functions.

storage

Save data to a desired storage backend.

Structs

Feed

Append-only log structure.

Node

Nodes that are persisted to disk.