Expand description
Storage subsystem for chunk persistence.
This module provides content-addressed LMDB storage for chunks,
along with a protocol handler that integrates with saorsa-core’s
Protocol trait for automatic message routing.
§Architecture
┌─────────────────────────────────────────────────────────┐
│ AntProtocol (implements Protocol trait) │
├─────────────────────────────────────────────────────────┤
│ protocol_id() = "autonomi.ant.chunk.v1" │
│ │
│ handle(peer_id, data) ──▶ decode AntProtocolMessage │
│ │ │
│ ┌─────────────────────────┼─────────────────┐ │
│ ▼ ▼ ▼ │
│ QuoteRequest ChunkPutRequest ChunkGetRequest
│ │ │ │ │
│ ▼ ▼ ▼ │
│ QuoteGenerator PaymentVerifier LmdbStorage│
│ │ │ │ │
│ └─────────────────────────┴─────────────────┘ │
│ │ │
│ return Ok(Some(response_bytes)) │
└─────────────────────────────────────────────────────────┘§Example
ⓘ
use std::sync::Arc;
use ant_node::storage::{AntProtocol, LmdbStorage, LmdbStorageConfig};
// Create storage
let config = LmdbStorageConfig::default();
let storage = Arc::new(LmdbStorage::new(config).await?);
// Create protocol handler
let protocol = AntProtocol::new(storage, Arc::new(payment_verifier), Arc::new(quote_generator));
// Register with saorsa-core
listener.register_protocol(protocol).await?;Re-exports§
pub use migration::MigrationConfig;pub use migration::MigrationPhase;pub use migration::MigrationState;
Modules§
- migration
- Moving a node off LMDB and onto the file store without losing a chunk.
Structs§
- AntProtocol
- ANT protocol handler.
- Chunk
Store - Content-addressed chunk storage.
- Chunk
Store Config - Configuration for
ChunkStore. - File
Store - Content-addressed store holding one immutable file per chunk.
- File
Store Config - Configuration for
FileStore. - Lmdb
Storage - Content-addressed LMDB storage.
- Lmdb
Storage Config - Configuration for LMDB storage.
- Storage
Stats - Statistics about storage operations.
- Store
Layout - The on-disk layout marker.
- Verify
Report - What the pre-retirement verification pass found.
Constants§
- DEFAULT_
DISK_ RESERVE - Default free disk space to keep unused on the storage partition.
- GIB
- Bytes in one GiB.
- LEGACY_
ENV_ DIR - Directory name of the legacy LMDB environment, under the node root.
- MIB
- Bytes in one MiB.
Type Aliases§
- XorName
- Content-addressed identifier (32 bytes).