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
This module contains:
- Protocol message handlers: Send/await pattern for chunks
- Data types: Common types like
XorName,DataChunk, address computation
§Migration Note
The QuantumClient has been deprecated and consolidated into ant-client::Client.
Use ant-client for all client operations.
§Example
ⓘ
use ant_client::Client; // Use ant-client instead of QuantumClient
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// High-level client API
let client = Client::connect(&bootstrap_peers, Default::default()).await?;
// Store data with payment
let address = client.chunk_put(bytes::Bytes::from("hello world")).await?;
// Retrieve data
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
- A content-addressed identifier (32 bytes).