3 releases
0.1.2 | Oct 7, 2024 |
---|---|
0.1.1 | Oct 1, 2024 |
0.1.0 | Sep 24, 2024 |
#465 in Magic Beans
479 downloads per month
1MB
15K
SLoC
autonomi
- Autonomi client API
Connect to and build on the Autonomi network.
Usage
See docs.rs/autonomi for usage examples.
Running tests
Run a local network with the local-discovery
feature:
cargo run --bin=safenode-manager --features=local-discovery -- local run --build --clean
Then run the tests with the local
feature:
$ cargo test --package=autonomi --features=local
# Or with logs
$ RUST_LOG=autonomi cargo test --package=autonomi --features=local -- --nocapture
lib.rs
:
Connect to and build on the Autonomi network.
Data types
This API gives access to two fundamental types on the network: chunks and registers.
When we upload data, it's split into chunks using self-encryption, yielding a 'data map' allowing us to reconstruct the data again. Any two people that upload the exact same data will get the same data map, as all chunks are content-addressed and self-encryption is deterministic.
Registers can keep small values pointing to data. This value can be updated and the history is kept. Multiple values can exist side by side in case of concurrency, but should converge to a single value eventually.
Example
let peers = ["/ip4/127.0.0.1/udp/1234/quic-v1".parse()?];
let client = Client::connect(&peers).await?;
let addr = client.put(Bytes::from("Hello, World"), &mut wallet).await?;
let data = client.get(addr).await?;
assert_eq!(data, Bytes::from("Hello, World"));
Features
local
: Discover local peers using mDNS. Useful for development.
Dependencies
~49–87MB
~2M SLoC