weave-weft · dht
Source declarations, signatures and documentation for dht.
Reviewed implementation boundary: Producer signatures must be computed over the exact manifest before validate/from_bytes or publication; an empty signature is rejected. Reader interfaces do not establish constant-memory storage, and chain reference metadata alone does not submit or prove anchoring. See /libraries/weft/publish.
Source: sigil/weave/models/weft/src/dht.rs. SHA-256: 103c328a5317188414f23446b71a256d08f93fe3d8c2decccab59a28c79aefc6.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
dht::DhtKv
Minimal DHT key/value surface Weft needs.
#[async_trait]
pub trait DhtKv: Send + Sync {
/// Put one record under an exact key.
async fn put(&self, key: Vec<u8>, value: Vec<u8>) -> Result<()>;
/// Get one record by exact key.
async fn get(&self, key: Vec<u8>) -> Result<Option<Vec<u8>>>;
}Source line: 22.
dht::WeftDhtStore
Weft adapter over a DHT-compatible key/value backend.
#[derive(Debug)]
pub struct WeftDhtStore<K> {
}Source line: 32.
dht::WeftDhtStore<K>::new
Create a Weft DHT adapter.
pub fn new(kv: Arc<K>) -> Self;Source line: 49.
dht::WeftDhtStore<K>::manifest_key
Deterministic manifest record key.
pub fn manifest_key(root: WeftHash) -> Vec<u8>;Source line: 54.
dht::WeftDhtStore<K>::chunk_key
Deterministic chunk record key.
pub fn chunk_key(chunk_id: WeftHash) -> Vec<u8>;Source line: 59.
dht::WeftDhtStore<K>::availability_key
Deterministic availability record key.
pub fn availability_key(root: WeftHash) -> Vec<u8>;Source line: 64.
dht::WeftDhtStore<K>::publish_bytes
Publish payload bytes into DHT-compatible records.
pub async fn publish_bytes(
&self,
bytes: &[u8],
config: ChunkConfig,
producer: ManifestProducer,
artifact: ArtifactMetadata,
peer: PeerId,
) -> Result<PublishedWeft>;Source line: 69.
dht::WeftDhtStore<K>::serve_manifest
Serve a manifest by root from DHT-compatible records.
pub async fn serve_manifest(&self, root: WeftHash) -> Result<Option<WeftManifest>>;Source line: 112.
dht::WeftDhtStore<K>::fetch_payload
Discover advertisements, fetch chunks, and verify/reassemble a payload.
pub async fn fetch_payload(&self, root: WeftHash, max_parallelism: usize) -> Result<Vec<u8>>;Source line: 121.
dht::InMemoryDhtKv
Deterministic in-process DHT KV used by adapter tests and local embedding.
#[derive(Debug, Default)]
pub struct InMemoryDhtKv {
}Source line: 196.
dht::InMemoryDhtKv::contains_key
Return whether a key exists.
pub fn contains_key(&self, key: Vec<u8>) -> Result<bool>;Source line: 202.