Skip to main content

Module mesh_artifact_transfer

Module mesh_artifact_transfer 

Source
Expand description

Serve and fetch for the artifact piece protocol (mesh-placement-11).

One MeshStream carries a client-driven exchange:

fetcher                              holder
  meta_request(key)        0x0B  ->
                           <-  0x0C  meta(descriptor) | reject
                           <-  0x0B  announce(have)
  announce(have)           0x0B  ->
  request(id, [i..])       0x0B  ->
                           <-  0x0C  piece(i, offset, block)... | no_piece(i)

Every piece is hash-checked before it reaches ArtifactStore; a bad piece is chained (artifact.piece_rejected) and requested again. When all pieces are held the whole-content hash is checked. A peer whose descriptor fails that check lied about the content: its descriptor and unshared pieces are discarded, the peer is dropped and the next peer is tried. The fetch outcome is chained once (artifact.fetch), listing any rejected descriptors.

v1 fetches from one peer at a time, walking a PeerSet in order. Card 25 plugs a multi-source PieceScheduler and parallel peers into the same types.

Re-exportsยง

pub use crate::mesh_artifact_peers::FetchError;
pub use crate::mesh_artifact_peers::FetchOutcome;
pub use crate::mesh_artifact_peers::PeerSet;
pub use crate::mesh_artifact_peers::PieceScheduler;
pub use crate::mesh_artifact_peers::SequentialScheduler;
pub use crate::mesh_artifact_peers::ServeStats;