Weft
API Surface
Public API surface for `weave-weft` — every exported item, method target, module, and re-export, each linked to its source path.
Public API Map
Generated from source under models/weft. Every exported item, trait, and constant is listed here.
Modules
| Module | Source | Purpose |
|---|---|---|
chunk | src/chunk.rs | Chunking, chunk IDs, descriptor types |
dht | src/dht.rs | DhtKv trait, WeftDhtStore, InMemoryDhtKv |
discovery | src/discovery.rs | Availability advertisements and discovery boundary |
fetch | src/fetch.rs | fetch_manifest, ChunkSource, FetchRequest |
local | src/local.rs | LocalWeftStore, filesystem-backed store |
manifest | src/manifest.rs | WeftManifest, producer + artifact metadata |
tree | src/tree.rs | Merkle tree and inclusion proofs |
| (root) | src/lib.rs | WeftHash, WeftError, Result |
Top-level types
WeftHash— 32-byte BLAKE3 hash with hex serializationWeftError— error enum returned by every fallible APIResult<T>— type alias forstd::result::Result<T, WeftError>
chunk module
| Item | Kind | Notes |
|---|---|---|
DEFAULT_CHUNK_SIZE | const usize | 4 MiB |
MAX_CHUNK_SIZE | const usize | 64 MiB |
CHUNK_ID_DOMAIN | const &[u8] | b"weave/weft/chunk/v1\n" |
ChunkConfig | struct | new(chunk_size: usize), chunk_size() |
ChunkDescriptor | struct | index, offset, len, id |
ChunkPayload | struct | descriptor, bytes |
Chunker<R> | struct | Streaming chunker, new, next_chunk |
chunk_id_for_bytes | fn | BLAKE3 chunk id for a single chunk |
chunk_bytes | fn | Split bytes into ordered descriptors |
chunk_payloads | fn | Split bytes into descriptors + payloads |
tree module
MerkleTree—from_leaves(...),root(),prove(index)MerkleProof— siblings + position listProofSibling,ProofPosition
manifest module
WEFT_MANIFEST_SCHEMA—"weave.weft.manifest.v1"WEFT_MANIFEST_VERSION—1WeftManifest— see Manifestfrom_bytes(...)from_chunk_descriptors(...)to_canonical_bytes()from_canonical_bytes(...)signing_payload()validate()
ManifestProducer— DID + signatureArtifactMetadata— media_type, schema, optional registry pointersParitySpec— reserved
fetch module
FetchRequest—manifest,availability,max_parallelismChunkSource— async traitfetch(&self, peer, id) -> Result<Vec<u8>>fetch_manifest(request, source)— main entry pointInMemoryChunkSource— testing helper
discovery module
WEFT_AVAILABILITY_PROTOCOL—"weave.weft.availability.v1"PeerId—new(value),as_str()AvailabilitySet—AllorExplicit(BTreeSet<u64>)AdvertisementScope—Provider,Mirror,CacheAvailabilityAdvertisement— bounded, validated advertisementDiscoveryPublisher— async trait:advertise(...),discover(...)InMemoryDiscovery— deterministic implementationFailClosedDiscovery— placeholder when no adapter is linked
local module
LocalWeftStore— filesystem or in-memory storein_memory()open(path)publish_bytes(...)/publish_reader(...)serve_manifest(root)/serve_manifest_bytes(root)serve_chunk(descriptor)fetch_payload(root, max_parallelism)status()
PublishedWeft— return value withmanifest,manifest_bytes,advertisementLocalWeftStatus— operator-facing counts
dht module
DhtKv— async trait:put,getWeftDhtStore<K>— store generic over aDhtKvimplementationnew(kv)manifest_key(root)/chunk_key(id)/availability_key(root)publish_bytes(...)serve_manifest(root)fetch_payload(root, max_parallelism)
InMemoryDhtKv— testing helper
Error variants
| Variant | Cause |
|---|---|
WeftError::Manifest(String) | Manifest validation failure |
WeftError::InvalidHash(String) | Hex parsing or chunk hash mismatch |
WeftError::Discovery(String) | Advertisement validation, lock poison, or adapter failure |
WeftError::Fetch(String) | Network or adapter fetch error |
WeftError::Io(io::Error) | Filesystem error in LocalWeftStore |
WeftError::Serde(serde_json::Error) | Canonical bytes encode/decode failure |
WeftError::Unsupported(String) | Reserved feature (parity, missing adapter) |
Spec
See specs/WEFT.md in the Weave repository for wire semantics, readiness constraints, and the parity-roadmap.