Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Hypercore LTS Version 10 #138

Merged
merged 158 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
48e8020
fix: tests compile only by temporarily allowing dead code for page_len
ttiurani Jul 20, 2022
e154f79
test: add skeleton for Javascript interop tests
ttiurani Aug 1, 2022
7d7a809
Add beginnings of test for rust creation of the same feed
ttiurani Aug 5, 2022
ae4f7f3
Beginnings of compact_encoding primitives
ttiurani Aug 16, 2022
3076268
Nicer API
ttiurani Aug 17, 2022
0756a1d
Efficient API where the buffer is owned by the client
ttiurani Aug 17, 2022
bbcc95c
Some code for String, u32 and usize encoding
ttiurani Aug 17, 2022
47e4dbc
Some more work and tests
ttiurani Aug 18, 2022
f48f844
Skeleton for Oplog
ttiurani Aug 18, 2022
bfe10d1
Again asserting test
ttiurani Aug 18, 2022
39a3df1
Encoding of byte buffer
ttiurani Aug 19, 2022
eeabc4a
Initial oplog structs
ttiurani Aug 22, 2022
9805234
Secret key is optional
ttiurani Aug 22, 2022
4df7f3b
Feature flag v10 code
ttiurani Aug 23, 2022
4cfe1c4
Move random-access-disk to dev deps in v10 to make WASM build possible
ttiurani Aug 23, 2022
4cd4f12
Revert "Move random-access-disk to dev deps in v10 to make WASM build…
ttiurani Aug 23, 2022
04e0db2
Make v10 buildable with WASM
ttiurani Aug 23, 2022
e1b168b
Hypercore is the type for the v10 interface, some work to make that h…
ttiurani Aug 24, 2022
85bc332
Move to storage_v10 to avoid excessive feature flagging
ttiurani Aug 24, 2022
728e1b2
Milestone 1: opening a hypercore produces identical oplog
ttiurani Aug 30, 2022
eda0266
Add test for appending Hello World in JS
ttiurani Aug 30, 2022
b178ff1
Simpler interfacing with javascript test code
ttiurani Aug 30, 2022
611cc01
Some work towards opening an existing oplog
ttiurani Aug 30, 2022
2fd950b
Oplog returns current header to core
ttiurani Aug 31, 2022
af9a467
Attempt at moving to the blake2 crate, but alas, it lacks features.
ttiurani Aug 31, 2022
1c70fb2
Add v10 LE implementations of hashing
ttiurani Aug 31, 2022
6e8690d
Some work on reading the Merkle tree
ttiurani Sep 1, 2022
f5f6f73
Some more work on tree
ttiurani Sep 2, 2022
68fa704
Function params don't need Box
ttiurani Sep 2, 2022
82a0160
Same with encode_buffer, does not need Box
ttiurani Sep 2, 2022
9725ca4
Added byte lenght and total length to the MerkleTree
ttiurani Sep 2, 2022
29c170c
Some more work on creating the right kind of merkle tree
ttiurani Sep 5, 2022
cb9456b
Move compact encoding stuff to their own files, initial file for Entry
ttiurani Sep 5, 2022
76d448b
Initial entry compact encoding
ttiurani Sep 6, 2022
913ec44
The correct data is written
ttiurani Sep 6, 2022
5a6d19d
Some part of entries are written to oplog
ttiurani Sep 6, 2022
062e048
Oplog should be roughly correct
ttiurani Sep 6, 2022
b5e2ae6
Creates an identical oplog to JS
ttiurani Sep 6, 2022
5c72fa4
Almost the right oplog
ttiurani Sep 6, 2022
2162ffa
Added fixed bitfield
ttiurani Sep 6, 2022
2285eef
Move store manipulation to its own file
ttiurani Sep 7, 2022
e448217
Use intmap in place of big-sparse-array
ttiurani Sep 7, 2022
2b8126e
Removed read_all method, use StoreInfoInstruction for that too
ttiurani Sep 7, 2022
f8c3e39
Open bitfield
ttiurani Sep 7, 2022
abdfae3
Added setting range to fixed bitfield
ttiurani Sep 7, 2022
f7838ec
Implement dynamic bitfield
ttiurani Sep 7, 2022
2d48fd2
Bitfield is flushed and identical to JS, same with Oplog
ttiurani Sep 7, 2022
f26459a
Milestone 2: Able to append to the hypercore and create an bit-for-bi…
ttiurani Sep 8, 2022
e773434
Fix compilation with v9
ttiurani Sep 8, 2022
af06e79
Use version of random-access-memory with truncate implemented
ttiurani Sep 9, 2022
7eb4acd
Added step 3 failing tests
ttiurani Sep 9, 2022
b14d077
A preliminary implementation of reading values
ttiurani Sep 12, 2022
934a608
Reading and simple appending without flushing works
ttiurani Sep 12, 2022
162ed84
Setup failing test for two entries to be read from the oplog on open.
ttiurani Sep 13, 2022
bbcc2d9
Implemented oplog entries read on open, and flushing of changes at th…
ttiurani Sep 13, 2022
2dcb22f
Use the same Either return value everywhere
ttiurani Sep 14, 2022
cba5e1a
One more into Either return
ttiurani Sep 14, 2022
3f65c75
Add delete test
ttiurani Sep 14, 2022
d7bcaf1
Add one big file to test sparse deletion
ttiurani Sep 14, 2022
4b48764
Block size seems to be 4096
ttiurani Sep 14, 2022
f50c6ac
Use random-access-disk with delete and sparse file support
ttiurani Sep 15, 2022
1efedb4
Bitfield index_of and last_index_of
ttiurani Sep 16, 2022
201e7ba
Clearing works, but random-access-disk still holepunches differently …
ttiurani Sep 16, 2022
91acd2c
Switch to explicit v9 feature to be able to use it from hypercore-pro…
ttiurani Sep 19, 2022
3fdfd78
For some reason from_bytes fails to compile when referenced in anothe…
ttiurani Sep 20, 2022
4780a59
Provide method to access the keypair
ttiurani Sep 21, 2022
37a7eb9
Encode Vec buffer, move replicator stuff out to hypercore-protocol-rs
ttiurani Oct 10, 2022
2ac5765
Move Node compact encoding to the main module to use in protocol
ttiurani Oct 15, 2022
821e756
Reorganize compact_encoding. Add types needed for verifying remote data.
ttiurani Oct 17, 2022
0ff300a
Move peer-related requests also here, to make a method for generating…
ttiurani Oct 17, 2022
3c2b3cc
Use flat_tree with missing methods implemented
ttiurani Oct 19, 2022
3ba963d
Somewhat working, but known buggy implementation of creating a proof
ttiurani Oct 19, 2022
b06744a
Remove forgotten JS debug
ttiurani Oct 19, 2022
cbffbc8
Made room for allowing for reading nodes failing
ttiurani Oct 20, 2022
4ea2c40
Fix issue with not tolerating missing node
ttiurani Oct 20, 2022
0e07f05
Proof creation should be working correctly now
ttiurani Oct 20, 2022
935e11d
Untested implementation of verifying a proof received from a peer
ttiurani Oct 21, 2022
54f4d9a
Verifying signature of a new proof works
ttiurani Oct 21, 2022
1657373
Verify and apply proof works, needs testing though
ttiurani Oct 24, 2022
be257ad
from_bytes didn't work, needs try_from
ttiurani Oct 24, 2022
3d5927b
Fix storage.len() compilation failing upstream, fix issue with byte o…
ttiurani Oct 24, 2022
d17ea01
Add compact encoding for Vec<u32>
ttiurani Nov 2, 2022
7ec84de
Added cenc support for raw buffer
ttiurani Nov 2, 2022
4e80125
Fix Vec<u32> double start increase
ttiurani Nov 2, 2022
7e5783b
Fix v9 compilation and tests
ttiurani Nov 3, 2022
a12fce0
Use upstream hypercore in JS interop tests
ttiurani Nov 4, 2022
1e61aff
Implement missing_nodes, fix bug with searching for byte offset
ttiurani Nov 21, 2022
b6360e1
Working simple memory benches, improvements in v10
ttiurani Jan 12, 2023
a2262b9
Added basic tokio compatibility
ttiurani Jan 23, 2023
4955cc2
Bump tokio version
ttiurani Jan 30, 2023
d7a1210
Remove unnecessary feature from tokio
ttiurani Jan 30, 2023
5e4093c
Add support for opening a hypercore without knowing the key pair
ttiurani Feb 3, 2023
499a8f3
Set merkle tree signature on open from header.
ttiurani Feb 17, 2023
127df9e
Enabled quickcheck model test for v10 as well
ttiurani Mar 14, 2023
0ce0e85
Remove v9/v10 feature flags and v9 code
ttiurani Mar 17, 2023
fcd6dfe
Rename v10 modules
ttiurani Mar 17, 2023
ca252f4
Use random-access-* with specialized error types
ttiurani Mar 17, 2023
074477f
Move compact_encoding to its own crate
ttiurani Mar 22, 2023
ea6fed0
Use explicit branch main
ttiurani Mar 22, 2023
02befa6
Remove v9-only file
ttiurani Mar 23, 2023
0dcf552
1/n switch from anyhow to thiserror
ttiurani Mar 23, 2023
1320301
Remove v9 file
ttiurani Mar 23, 2023
ba7987f
2/n switch from anyhow to thiserror
ttiurani Mar 23, 2023
92046ab
3/n switch from anyhow to thiserror
ttiurani Mar 23, 2023
fb87a49
4/n switch from anyhow to thiserror
ttiurani Mar 23, 2023
5724f6c
5/5 switch from anyhow to thiserror
ttiurani Mar 23, 2023
0f1d5f4
Remove unused async_std hard dependency
ttiurani Mar 24, 2023
a884b3f
Switch to a builder interface to be able to add backward compatible o…
ttiurani Mar 24, 2023
34a0f3a
Simplify builder with just one build() method
ttiurani Mar 24, 2023
6a75639
Add basic tracing error instrumentation to public interface methods
ttiurani Mar 24, 2023
8acc5b6
Fix bench, remove unnecessary set_ from builder
ttiurani Mar 27, 2023
13672c7
Fix unflushed nodes never emptying.
ttiurani Mar 28, 2023
a4a3beb
Fix byte range in some situations needing more than two calls
ttiurani Mar 28, 2023
ccd62f8
Add moka cache for nodes
ttiurani Mar 28, 2023
5101620
Use error-returning compact encoding
ttiurani Apr 3, 2023
ec9e329
Export also EncodingErrorKind
ttiurani Apr 4, 2023
91938c1
Use merged compact encoding
ttiurani Apr 4, 2023
abd8986
Bump version
ttiurani Apr 4, 2023
7e38e05
Remove v9 merkle.rs
ttiurani Apr 5, 2023
46e91de
Fix build warnings
ttiurani Apr 5, 2023
425fc3d
Fix some clippy warnings
ttiurani Apr 5, 2023
6fd5f74
Fix rest of src/ clippy warnings
ttiurani Apr 5, 2023
673381e
Fix clippy from tests and benches
ttiurani Apr 5, 2023
910de8c
Reintroduce test failures from warnings
ttiurani Apr 5, 2023
671d4ac
Fix visibility to enable unreachable_pub
ttiurani Apr 6, 2023
bffe41c
Use released compact-encoding
ttiurani Apr 6, 2023
42d7089
Use latest random-access-disk with async-std as default
ttiurani Apr 6, 2023
aea7909
Switch from quickcheck to proptest
ttiurani Apr 6, 2023
b9462e9
Use released random access crates
ttiurani Apr 12, 2023
d0ec17b
Use released flat-tree crate
ttiurani Apr 12, 2023
c084667
Fix accidental default features
ttiurani Apr 12, 2023
1a2ff4f
Export structs used in API
ttiurani Aug 15, 2023
8326d6d
Bump version to make new exports usable
ttiurani Aug 15, 2023
0f47cc7
Change append_batch to support both Vec<Vec<u8>> and &[&[u8]]
ttiurani Aug 15, 2023
9c2675f
Upgrade to ed25519-dalek 2.0.0 and rand 0.8
ttiurani Aug 17, 2023
bd9a0e2
Fix bug with storing read-only hypercore
ttiurani Aug 17, 2023
010f342
For efficiency, use SigningKey directly in PartialKeypair so that it …
ttiurani Aug 18, 2023
0520eda
Add make_read_only to turn a writeable hypercore into a read-only
ttiurani Aug 18, 2023
13a176f
Simpler getting a vector with just one element
ttiurani Aug 21, 2023
c884028
Switch to blake2 from unmaintained blake2-rfc
ttiurani Oct 2, 2023
de62da9
Fix compatibility with JS v10 oplog that includes the manifest
ttiurani Oct 3, 2023
01795b8
Bump version
ttiurani Oct 3, 2023
1b99951
Fix clippy warnings
ttiurani Oct 3, 2023
16e63c3
Fix tests for the tokio runtime
ttiurani Oct 3, 2023
7269a0f
Fix benches to work also with tokio
ttiurani Oct 3, 2023
0b26693
Added examples of memory and disk storages with basic functionality
ttiurani Oct 3, 2023
1414986
Merge branch 'master' into v10
ttiurani Oct 3, 2023
66633bf
Change missing_nodes to accept hypercore index
ttiurani Oct 4, 2023
0041eeb
Fix WASM build
ttiurani Oct 4, 2023
4ca4037
Add basic library level documentation
ttiurani Oct 4, 2023
bdc843a
Fix broken tests from missing_nodes change
ttiurani Oct 4, 2023
e7aabf9
Fix README and introduce GHA
ttiurani Oct 4, 2023
111c9a8
Use 2021 Rust edition
ttiurani Oct 4, 2023
d7c2fa8
Don't run JS interoperability tests on Windows which doesn't have nod…
ttiurani Oct 4, 2023
f6fa0f5
Fix CI to run on master and add features to README
ttiurani Oct 4, 2023
ec61046
Fix deps: bump valid and remove unneeded
ttiurani Oct 5, 2023
e8024d1
docs: provide commands to run the examples
ttiurani Oct 5, 2023
68ef0e0
Run benches once during tests, don't just build them
ttiurani Oct 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: 'CI'
on:
pull_request:
push:
branches:
- master

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always

jobs:
ci-pass:
name: CI is green
runs-on: ubuntu-latest
needs:
- test-linux
- test-windows
- test-macos
- build-extra
- lint
steps:
- run: exit 0

test-linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run tests
run: |
cargo check --no-default-features --features tokio
cargo check --no-default-features --features tokio,sparse
cargo check --no-default-features --features tokio,sparse,cache
cargo check --no-default-features --features async-std
cargo check --no-default-features --features async-std,sparse
cargo check --no-default-features --features async-std,sparse,cache
cargo test --no-default-features --features js_interop_tests,tokio
cargo test --no-default-features --features js_interop_tests,tokio,sparse
cargo test --no-default-features --features js_interop_tests,tokio,sparse,cache
cargo test --no-default-features --features js_interop_tests,async-std
cargo test --no-default-features --features js_interop_tests,async-std,sparse
cargo test --no-default-features --features js_interop_tests,async-std,sparse,cache
cargo test --benches --no-default-features --features tokio
cargo test --benches --no-default-features --features async-std

test-windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run tests
run: |
cargo check --no-default-features --features tokio
cargo check --no-default-features --features tokio,sparse
cargo check --no-default-features --features tokio,sparse,cache
cargo check --no-default-features --features async-std
cargo check --no-default-features --features async-std,sparse
cargo check --no-default-features --features async-std,sparse,cache
cargo test --no-default-features --features tokio
cargo test --no-default-features --features tokio,sparse
cargo test --no-default-features --features tokio,sparse,cache
cargo test --no-default-features --features async-std
cargo test --no-default-features --features async-std,sparse
cargo test --no-default-features --features async-std,sparse,cache
cargo test --benches --no-default-features --features tokio
cargo test --benches --no-default-features --features async-std

test-macos:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run tests
run: |
cargo check --no-default-features --features tokio
cargo check --no-default-features --features tokio,sparse
cargo check --no-default-features --features tokio,sparse,cache
cargo check --no-default-features --features async-std
cargo check --no-default-features --features async-std,sparse
cargo check --no-default-features --features async-std,sparse,cache
cargo test --no-default-features --features js_interop_tests,tokio
cargo test --no-default-features --features js_interop_tests,tokio,sparse
cargo test --no-default-features --features js_interop_tests,tokio,sparse,cache
cargo test --no-default-features --features js_interop_tests,async-std
cargo test --no-default-features --features js_interop_tests,async-std,sparse
cargo test --no-default-features --features js_interop_tests,async-std,sparse,cache
cargo test --benches --no-default-features --features tokio
cargo test --benches --no-default-features --features async-std

build-extra:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Build WASM
run: |
cargo build --target=wasm32-unknown-unknown --no-default-features --features tokio
cargo build --target=wasm32-unknown-unknown --no-default-features --features async-std
- name: Build release
run: |
cargo build --release --no-default-features --features tokio
cargo build --release --no-default-features --features tokio,sparse
cargo build --release --no-default-features --features tokio,sparse,cache
cargo build --release --no-default-features --features async-std
cargo build --release --no-default-features --features async-std,sparse
cargo build --release --no-default-features --features async-std,sparse,cache
- name: Run examples
run: |
cargo run --no-default-features --features tokio --example disk
cargo run --no-default-features --features async-std --example disk
cargo run --no-default-features --features tokio --example memory
cargo run --no-default-features --features async-std --example memory
cargo run --no-default-features --features tokio --example replication
cargo run --no-default-features --features async-std --example replication

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Format check
run: |
cargo fmt -- --check
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ npm-debug.log*
.nyc_output
target/
Cargo.lock
package-lock.json

my-first-dataset/
feed.db/
.vscode
tests/js/work
81 changes: 56 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[package]
name = "hypercore"
version = "0.11.1-beta.10"
version = "0.12.0-alpha.9"
license = "MIT OR Apache-2.0"
description = "Secure, distributed, append-only log"
documentation = "https://docs.rs/hypercore"
repository = "https://github.com/datrs/hypercore"
readme = "README.md"
authors = ["Yoshua Wuyts <[email protected]>"]
authors = [
"Yoshua Wuyts <[email protected]>",
"Timo Tiuraniemi <[email protected]>"
]
keywords = ["dat", "p2p", "stream", "feed", "merkle"]
categories = [
"asynchronous",
Expand All @@ -15,33 +18,61 @@ categories = [
"data-structures",
"encoding",
]
edition = "2018"
edition = "2021"

[dependencies]
blake2-rfc = "0.2.18"
byteorder = "1.3.4"
ed25519-dalek = "1.0.1"
anyhow = "1.0.26"
flat-tree = "5.0.0"
lazy_static = "1.4.0"
memory-pager = "0.9.0"
merkle-tree-stream = "0.12.0"
pretty-hash = "0.4.1"
rand = "0.7.3"
random-access-disk = "2.0.0"
random-access-memory = "2.0.0"
random-access-storage = "4.0.0"
sha2 = "0.9.2"
sleep-parser = "0.8.0"
sparse-bitfield = "0.11.0"
tree-index = "0.6.0"
bitfield-rle = "0.2.0"
futures = "0.3.4"
async-std = "1.5.0"
blake2 = "0.10"
byteorder = "1"
ed25519-dalek = { version = "2", features = ["rand_core"] }
getrandom = { version = "0.2", features = ["js"] }
thiserror = "1"
tracing = "0.1"
compact-encoding = "1"
flat-tree = "6"
merkle-tree-stream = "0.12"
pretty-hash = "0.4"
rand = "0.8"
random-access-memory = "3"
random-access-storage = "5"
sha2 = "0.10"
futures = "0.3"
crc32fast = "1"
intmap = "2"
moka = { version = "0.12", optional = true, features = ["sync"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
random-access-disk = { version = "3", default-features = false }

[dev-dependencies]
quickcheck = "0.9.2"
anyhow = "1.0.70"
proptest = "1.1.0"
proptest-derive = "0.2.0"
data-encoding = "2.2.0"
remove_dir_all = "0.7.0"
tempfile = "3.1.0"
async-std = { version = "1.5.0", features = ["attributes"] }
async-std = { version = "1.12.0", features = ["attributes"] }
tokio = { version = "1.27.0", default-features = false, features = ["macros", "rt", "rt-multi-thread"] }
tokio-test = "0.4"
sha2 = "0.10"
criterion = { version = "0.4", features = ["async_std", "async_tokio"] }
test-log = { version = "0.2.11", default-features = false, features = ["trace"] }
tracing-subscriber = { version = "0.3.16", features = ["env-filter", "fmt"] }

[features]
default = ["async-std", "sparse"]
sparse = ["random-access-disk/sparse"]
tokio = ["random-access-disk/tokio"]
async-std = ["random-access-disk/async-std"]
cache = ["moka"]
# Used only in interoperability tests under tests/js-interop which use the javascript version of hypercore
# to verify that this crate works. To run them, use:
# cargo test --features js-interop-tests
js_interop_tests = []

[[bench]]
name = "memory"
harness = false

[[bench]]
name = "disk"
harness = false
82 changes: 64 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,99 @@
# hypercore
# Hypercore
[![crates.io version][1]][2] [![build status][3]][4]
[![downloads][5]][6] [![docs.rs docs][7]][8]

WIP. Secure, distributed, append-only log structure. Adapted from
[mafintosh/hypercore](https://github.com/mafintosh/hypercore).
Hypercore is a secure, distributed append-only log. This crate is a limited Rust
port of the original Javascript
[holepunchto/hypercore](https://github.com/holepunchto/hypercore). The goal is to
maintain binary compatibility with the LTS version with regards to disk storage.

See [hypercore-protocol-rs](https://github.com/datrs/hypercore-protocol-rs) for the
corresponding wire protocol implementation.

- [Documentation][8]
- [Crates.io][2]

**NOTE**: The master branch currently only works with the old hypercore version 9.
For ongoing work to support the latest version 10 of hypercore [see the v10 branch](https://github.com/datrs/hypercore/tree/v10).
## Features

- [x] Create [in-memory](https://github.com/datrs/random-access-memory) and [disk](https://github.com/datrs/random-access-disk) hypercores
- [x] Append to hypercore either a single entry or a batch of entries
- [x] Get entries from hypercore
- [x] Clear range from hypercore, with optional support for sparse files
- [x] Support basic replication by creating proofs in a source hypercore and verifying and applying them to a destination hypercore
- [x] Support `tokio` or `async-std` runtimes
- [x] Support WASM for in-memory storage
- [x] Test Javascript interoperability for supported features
- [x] Add optional read cache
- [ ] Support the new [manifest](https://github.com/holepunchto/hypercore/blob/main/lib/manifest.js) in the wire protocol to remain compatible with upcoming v11
- [ ] Finalize documentation and release v1.0.0

## Usage

```rust
let mut feed = hypercore::open("./feed.db").await?;
// Create an in-memory hypercore using a builder
let mut hypercore = HypercoreBuilder::new(Storage::new_memory().await.unwrap())
.build()
.await
.unwrap();

feed.append(b"hello").await?;
feed.append(b"world").await?;
// Append entries to the log
hypercore.append(b"Hello, ").await.unwrap();
hypercore.append(b"world!").await.unwrap();

assert_eq!(feed.get(0).await?, Some(b"hello".to_vec()));
assert_eq!(feed.get(1).await?, Some(b"world".to_vec()));
// Read entries from the log
assert_eq!(hypercore.get(0).await.unwrap().unwrap(), b"Hello, ");
assert_eq!(hypercore.get(1).await.unwrap().unwrap(), b"world!");
```

Find more examples in the [examples](./examples) folder, and/or run:

```bash
cargo run --example memory
cargo run --example disk
cargo run --example replication
```

## Installation
```sh
$ cargo add hypercore

```bash
cargo add hypercore
```

## Safety
This crate uses ``#![deny(unsafe_code)]`` to ensure everything is implemented in

This crate uses ``#![forbid(unsafe_code)]`` to ensure everythong is implemented in
100% Safe Rust.

## Development

To test interoperability with Javascript, enable the `js_interop_tests` feature:

```bash
cargo test --features js_interop_tests
```

Run benches with:

```bash
cargo bench
```

## Contributing

Want to join us? Check out our ["Contributing" guide][contributing] and take a
look at some of these issues:

- [Issues labeled "good first issue"][good-first-issue]
- [Issues labeled "help wanted"][help-wanted]

## References
- [github.com/mafintosh/hypercore](https://github.com/mafintosh/hypercore)

## License

[MIT](./LICENSE-MIT) OR [Apache-2.0](./LICENSE-APACHE)

[1]: https://img.shields.io/crates/v/hypercore.svg?style=flat-square
[2]: https://crates.io/crates/hypercore
[3]: https://img.shields.io/travis/datrs/hypercore/master.svg?style=flat-square
[4]: https://travis-ci.org/datrs/hypercore
[3]: https://github.com/datrs/hypercore/actions/workflows/ci.yml/badge.svg
[4]: https://github.com/datrs/hypercore/actions
[5]: https://img.shields.io/crates/d/hypercore.svg?style=flat-square
[6]: https://crates.io/crates/hypercore
[7]: https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square
Expand Down
Loading
Loading