Expand description
Protocol helpers for ant-node client operations.
This module provides low-level protocol support for client-node
communication. For high-level client operations, use the ant-client
crate instead.
§Architecture
As of 0.11, the shared protocol types and helpers live in the
ant_protocol crate. This module re-exports them so existing
callers of ant_node::client::* continue to compile; new code
should prefer ant_protocol::* directly.
§Example
ⓘ
use ant_client::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(&bootstrap_peers, Default::default()).await?;
let address = client.chunk_put(bytes::Bytes::from("hello world")).await?;
let chunk = client.chunk_get(&address).await?;
Ok(())
}Structs§
- Chunk
Stats - Statistics about chunk operations.
- Data
Chunk - A chunk of data with its content-addressed identifier.
Functions§
- compute_
address - Compute the content address (BLAKE3 hash) for the given data.
- hex_
node_ id_ to_ encoded_ peer_ id - Convert a hex-encoded 32-byte node ID to an
EncodedPeerId. - peer_
id_ to_ xor_ name - Convert a hex-encoded peer ID string to an
XorName. - send_
and_ await_ chunk_ response - Send a chunk-protocol message to
target_peerand await a matching response. - xor_
distance - Compute the XOR distance between two 32-byte addresses.
Type Aliases§
- XorName
- Content-addressed identifier (32 bytes).