WeaveDocs
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

ModuleSourcePurpose
chunksrc/chunk.rsChunking, chunk IDs, descriptor types
dhtsrc/dht.rsDhtKv trait, WeftDhtStore, InMemoryDhtKv
discoverysrc/discovery.rsAvailability advertisements and discovery boundary
fetchsrc/fetch.rsfetch_manifest, ChunkSource, FetchRequest
localsrc/local.rsLocalWeftStore, filesystem-backed store
manifestsrc/manifest.rsWeftManifest, producer + artifact metadata
treesrc/tree.rsMerkle tree and inclusion proofs
(root)src/lib.rsWeftHash, WeftError, Result

Top-level types

  • WeftHash — 32-byte BLAKE3 hash with hex serialization
  • WeftError — error enum returned by every fallible API
  • Result<T> — type alias for std::result::Result<T, WeftError>

chunk module

ItemKindNotes
DEFAULT_CHUNK_SIZEconst usize4 MiB
MAX_CHUNK_SIZEconst usize64 MiB
CHUNK_ID_DOMAINconst &[u8]b"weave/weft/chunk/v1\n"
ChunkConfigstructnew(chunk_size: usize), chunk_size()
ChunkDescriptorstructindex, offset, len, id
ChunkPayloadstructdescriptor, bytes
Chunker<R>structStreaming chunker, new, next_chunk
chunk_id_for_bytesfnBLAKE3 chunk id for a single chunk
chunk_bytesfnSplit bytes into ordered descriptors
chunk_payloadsfnSplit bytes into descriptors + payloads

tree module

  • MerkleTreefrom_leaves(...), root(), prove(index)
  • MerkleProof — siblings + position list
  • ProofSibling, ProofPosition

manifest module

  • WEFT_MANIFEST_SCHEMA"weave.weft.manifest.v1"
  • WEFT_MANIFEST_VERSION1
  • WeftManifest — see Manifest
    • from_bytes(...)
    • from_chunk_descriptors(...)
    • to_canonical_bytes()
    • from_canonical_bytes(...)
    • signing_payload()
    • validate()
  • ManifestProducer — DID + signature
  • ArtifactMetadata — media_type, schema, optional registry pointers
  • ParitySpec — reserved

fetch module

  • FetchRequestmanifest, availability, max_parallelism
  • ChunkSource — async trait fetch(&self, peer, id) -> Result<Vec<u8>>
  • fetch_manifest(request, source) — main entry point
  • InMemoryChunkSource — testing helper

discovery module

  • WEFT_AVAILABILITY_PROTOCOL"weave.weft.availability.v1"
  • PeerIdnew(value), as_str()
  • AvailabilitySetAll or Explicit(BTreeSet<u64>)
  • AdvertisementScopeProvider, Mirror, Cache
  • AvailabilityAdvertisement — bounded, validated advertisement
  • DiscoveryPublisher — async trait: advertise(...), discover(...)
  • InMemoryDiscovery — deterministic implementation
  • FailClosedDiscovery — placeholder when no adapter is linked

local module

  • LocalWeftStore — filesystem or in-memory store
    • in_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 with manifest, manifest_bytes, advertisement
  • LocalWeftStatus — operator-facing counts

dht module

  • DhtKv — async trait: put, get
  • WeftDhtStore<K> — store generic over a DhtKv implementation
    • new(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

VariantCause
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.