Skip to main content

Crate bee_check

Crate bee_check 

Source
Expand description

Core check engine for bee-check.

The CLI in main.rs and (in future) the bee-check-web SPA both consume the same Report shape produced here. See SPEC.md for the JSON shape.

Structs§

ChunkProbe
ChunkStatRow
ChunkStats
Aggregate statistics over the per-chunk probe data. Per-vantage stats surface “fast on bee-A, slow on bee-B”; per-neighborhood stats surface “chunks in nb 0x1a are slow no matter which vantage”.
ChunkVantage
ColdDownloadResult
Cold end-to-end download probe. Pulls the full byte stream from /bytes/{ref} (for Bee vantages) or /bzz/{ref}/ (for gateways) and times the entire transfer. Distinct from the stewardship probe, which only walks the chunk graph — cold-download exercises the HTTP body transport too. Added in 0.5.
GatewayResult
HEAD-probe of a public Swarm gateway. The gateway resolves the reference end-to-end through forwarding Kademlia; a 2xx means “anyone could retrieve this through this gateway right now”, independent of any specific Bee node the user controls.
Report
ReseedRequest
StampStatus
Result of the --reseed --stamp <id> pre-flight check. Mirrors ipfs-check’s “stale records” hint in spirit: surface upstream-data problems before doing the operation.
VantageResult

Enums§

OutputFormat
ParsedInput
Output of parse_input.
Resolution
Records the input → reference resolution when the user supplied a mutable handle (currently: Swarm feeds). Added in 0.3.
Status
Outcome enum reported per vantage and aggregated for the whole check.

Constants§

DEFAULT_GATEWAY
Default public gateway used when no --gateway flag is supplied. api.gateway.ethswarm.org is the Foundation-operated forwarding gateway that returns proper 404s for unknown references (unlike gateway.ethswarm.org, which currently fronts a static page that 200s everything).

Functions§

annotate_target_overlay
Annotate each vantage with target_proximity (PO between its overlay and target_overlay_hex) and sort the vantages array by that proximity in descending order — closest first. No-op when target_overlay_hex doesn’t decode. Added in 0.4.
check_gateways
Probe public Swarm gateways via HEAD {gateway}/bzz/{ref} in parallel. Mirrors the BYO-Bee philosophy: gateway results complement (don’t replace) the vantage probes and aggregate into the same top-level status.
check_multi_vantage
Probe /stewardship/{ref} across all vantages in parallel. Alongside the retrievability call, fetches /addresses (overlay) and /health (Bee version) so the rendered report can surface which neighborhood the probe came from. These ancillary calls are best-effort: failure leaves overlay / bee_version unset rather than failing the whole vantage.
check_stamp
Pre-flight check before --reseed: look up GET /stamps/{id} on the target Bee and surface usable/expiry concerns. Mirrors the spirit of ipfs-check’s “stale records” UX hint — flag freshness problems before doing the operation.
cold_download_all
Cold end-to-end download probe. For each Bee vantage, issues GET /bytes/{ref} and streams the body to EOF, counting bytes and timing the full transfer. For each gateway, issues GET /bzz/{ref}/ instead (the canonical gateway path). Records bytes_downloaded + elapsed_ms per URL. Distinct from the stewardship probe: this exercises HTTP body transport, not just chunk-graph walking.
compute_chunk_stats
Roll up per-vantage + per-neighborhood timing statistics from a flat list of ChunkProbes. Pure function; runs in milliseconds even for the 1000-chunk cap.
drill_down
Walk the manifest at report.reference, probe each leaf chunk via GET /chunks/{addr} from every vantage, and attach the result to the report. When the per-vantage overlay is known (already fetched in check_multi_vantage), each ChunkVantage also carries the proximity between that vantage and the chunk.
merge_gateways
Append gateway results to an existing report and re-aggregate the top-level status. Splits the gateway probe from the main check so the SPA can show partial progress.
parse_input
Parse a positional input. Accepts either:
render_report
render_stamp_status
Human-readable summary of a stamp pre-flight check, suitable for stderr before a --reseed operation.
reseed
resolve_feed
Resolve a feed:OWNER:TOPIC input to its current chunk reference. bee_url is the first Bee vantage; the feed lookup goes through it. Returns the resolved reference and a Resolution record describing what was done.