From 4809c09850325e092682c72408440fc8914b5c96 Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Mon, 19 Feb 2018 09:19:26 -0700 Subject: [PATCH] Add docs Fixes #11 --- Cargo.toml | 2 +- README.md | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 26b5d18da8fa38..ef4e903c2571a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "silk" description = "A silky smooth implementation of the Loom architecture" -version = "0.1.3" +version = "0.2.0" documentation = "https://docs.rs/silk" homepage = "http://loomprotocol.com/" repository = "https://github.com/loomprotocol/silk" diff --git a/README.md b/README.md index 2367f5d92ed46a..73447302aee28d 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,30 @@ corresponding benchmarks are also added that demonstrate real performance boots. feature set here will always be a ways behind the loom repo, but that this is an implementation you can take to the bank, literally. +# Usage + +Add the latest [silk package] (https://crates.io/crates/silk) to the `[dependencies]` section +of your Cargo.toml. + +Create a *Historian* to create a *Proof-of-History* and then verify in parallel: + +```rust +use historian::Historian; +use log::{Event, verify_slice}; + +fn main() { + let hist = Historian::new(0); + + hist.sender.send(Event::Tick).unwrap(); + let entry0 = hist.receiver.recv().unwrap(); + + hist.sender.send(Event::UserDataKey(0xdeadbeef)).unwrap(); + let entry1 = hist.receiver.recv().unwrap(); + + assert!(verify_slice(&[entry0, entry1], 0)); +} +``` + # Developing Building