Skip to content

Hypercore storage and replication daemon, written in Rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

datrs/hyperspace-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hyperspace-rs

An exploration towards a Rust daemon for Hypercore storage and replication.

This repo contains a few different crates that together work towards an implementation of the hyperspace server (orignally written in Node.js). Hyperspace is a small server that stores and manages Hypercores, and can replicate Hypercores to peers found over the Hyperswarm distributed hash table.

Crates

All are still work in progress and in many parts unfinished.

  • hyperspace-server: Runs a Hypercore storage and networking daemon that can be talked with over an RPC socket through hrpc. Library and binary
  • hyperspace-client: A client that talks with a hyperspace server over hrpc and exposes a RemoteHypercore and RemoteCorestore. Libray and binary
  • corestore: Manage storage for hypercores. A port of corestore. Library
  • hypercore-replicator: Replicate Hypercores with hypercore-protocol. Manages channels for many feeds and peer connections. Library
  • hyperspace-common: Modules shared between server and client. RPC codegen, utilities. Library

Note: None of these crates are published on crates.io yet

Notes

Example

This example starts two hyperspace-server instances and runs a hyperswarm DHT node on localhost. It then uses hyperspace-client to create and append a hypercore on the first instance. Then, again with hyperspace-client, the same feed is requested from the second server instance, which should replicate it because the two servers find each other over the localhost DHT. All in Rust, no Node involved!

# The commands need to be run in seperate terminals each.

# 1. Start a DHT node
cargo run --bin hyperspace-server -- --dht -a 127.0.0.1:3401

# 2. Start server 1
cargo run --bin hyperspace-server -- -s /tmp/hs1 -h hs1 -b 127.0.0.1:3401

# 3. Start server 2
cargo run --bin hyperspace-server -- -s /tmp/hs2 -h hs2 -b 127.0.0.1:3401

# 4. Write to a feed on server 1
cargo run --bin hyperspace-client -- -h hs1 -n afeed write
# the feed's key will be printed
# (type something and press enter, it will be appended to the feed)

# 5. Read from the feed from server 2
cargo run --bin hyperspace-client -- -h hs2 -k KEY_FROM_ABOVE read

Contributing

This project, even though in early stages, is very open to contributions. If unsure, please find us in #datrs on IRC or open an issue first.

About

Hypercore storage and replication daemon, written in Rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages