Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cowlicks/replicator
Replicator for hypercores
https://github.com/cowlicks/replicator
Last synced: about 17 hours ago
JSON representation
Replicator for hypercores
- Host: GitHub
- URL: https://github.com/cowlicks/replicator
- Owner: cowlicks
- Created: 2024-04-12T19:34:57.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-10-17T18:47:25.000Z (21 days ago)
- Last Synced: 2024-10-20T04:26:34.630Z (19 days ago)
- Language: Rust
- Size: 200 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hypercore Replicator
# ⚠️ WARNING 🚧 API unstable ⚒️ and still in development 👷This repo defines a `Replicator` trait for use with [`Hypercore`](#todo). It implements the same functionality as this [JavaScript Hypercore replication code](https://github.com/holepunchto/hypercore/blob/3fda699f306fa3f4781ad66ea13ea0df108a48cd/lib/replicator.js).
Usage (aspirational):
```rust// import the trait
use replicator::Replicate;// Get a hypercore
let hypercore = HypercoreBuilder::new(Storage::new_memory().await.unwrap())
.build()
.await
.unwrap();// Get a AsyncRead + AsyncWrite stream to another hypercore
let listener = TcpListener::bind(&address).await?;// the `true` indicates this hypercore is the initiator
hypercore.replicate(stream, true))
```