1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//! ## Introduction
//!
//! Hypercore is a secure, distributed append-only log. Built for sharing
//! large datasets and streams of real time data as part of the [Dat] project.
//! This is a rust port of [the original Javascript version][holepunch-hypercore]
//! aiming for interoperability with LTS version. The primary way to use this
//! crate is through the [Hypercore] struct, which can be created using the
//! [HypercoreBuilder].
//!
//! This crate supports WASM with `cargo build --target=wasm32-unknown-unknown`.
//!
//! ## Features
//!
//! ### `sparse` (default)
//!
//! When using disk storage, clearing values may create sparse files. On by default.
//!
//! ### `async-std` (default)
//!
//! Use the async-std runtime, on by default. Either this or `tokio` is mandatory.
//!
//! ### `tokio`
//!
//! Use the tokio runtime. Either this or `async_std` is mandatory.
//!
//! ### `cache`
//!
//! Use a moka cache for merkle tree nodes to speed-up reading.
//!
//! ## Example
//! ```rust
//! # #[cfg(feature = "tokio")]
//! # tokio_test::block_on(async {
//! # example().await;
//! # });
//! # #[cfg(feature = "async-std")]
//! # async_std::task::block_on(async {
//! # example().await;
//! # });
//! # async fn example() {
//! use hypercore::{HypercoreBuilder, Storage};
//!
//! // Create an in-memory hypercore using a builder
//! let mut hypercore = HypercoreBuilder::new(Storage::new_memory().await.unwrap())
//! .build()
//! .await
//! .unwrap();
//!
//! // Append entries to the log
//! hypercore.append(b"Hello, ").await.unwrap();
//! hypercore.append(b"world!").await.unwrap();
//!
//! // 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] folder.
//!
//! [Dat]: https://github.com/datrs
//! [holepunch-hypercore]: https://github.com/holepunchto/hypercore
//! [Hypercore]: crate::core::Hypercore
//! [HypercoreBuilder]: crate::builder::HypercoreBuilder
//! [examples]: https://github.com/datrs/hypercore/tree/master/examples
pub use crateCacheOptionsBuilder;
pub use crateHypercoreBuilder;
pub use crate;
pub use crate;
pub use crate;
pub use crate;
pub use ;