weave-weft · fetch
Source declarations, signatures and documentation for fetch.
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/fetch.rs. SHA-256: bc90031fdebac8714faeeff324d1ed92e0e5c3fd90ad28271f3b5add45035a16.
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.
fetch::FetchRequest
Request to fetch and verify a full Weft manifest payload.
#[derive(Debug, Clone)]
pub struct FetchRequest {
/// Manifest to fetch.
pub manifest: WeftManifest,
/// Chunk index to candidate peers.
pub availability: BTreeMap<u64, Vec<PeerId>>,
/// Maximum concurrent chunk fetches.
pub max_parallelism: usize
}Source line: 15.
fetch::ChunkSource
Adapter boundary for retrieving chunks from peers.
#[async_trait]
pub trait ChunkSource: Send + Sync {
/// Fetch a chunk from one peer. `Ok(None)` means the peer does not have it.
async fn fetch_chunk(&self, peer: &PeerId, chunk: &ChunkDescriptor) -> Result<Option<Vec<u8>>>;
}Source line: 26.
fetch::fetch_manifest
Fetch, verify, and reassemble a Weft payload.
pub async fn fetch_manifest<S>(request: FetchRequest, source: Arc<S>) -> Result<Vec<u8>>
where
S: ChunkSource + 'static,;Source line: 32.
fetch::InMemoryChunkSource
Deterministic in-memory source for tests.
#[derive(Default)]
pub struct InMemoryChunkSource {
}Source line: 153.
fetch::InMemoryChunkSource::insert
Insert bytes under a peer and chunk id. The bytes are intentionally not pre-verified so tests can model dishonest peers.
pub fn insert(&self, peer: PeerId, id: WeftHash, bytes: Vec<u8>) -> Result<()>;Source line: 160.