Files
skills/docs/networking/network/network-plugin-content-delivery/README.md
2026-05-29 08:20:56 +01:00

12 KiB

@suaveplan/network-plugin-content-delivery - Mesh-as-CDN core: ChunkIndex (gossip-propagated holder map), ChunkRequestRouter (latency-aware routing with server fallback), RedundancyManager (N-copy enforcement + re-replication on peer churn), IntegrityVerifier (hash-agnostic verification + sender blacklisting), and ContentDeliveryPlugin facade. Drive-store, packer, prefetch, and bandwidth-throttle integrations live in follow-up changes.

Summary

Mesh-as-CDN core for the Suaveplan network. ChunkIndex maintains a distributed holder map keyed by chunk hash with gossip-style merge over ChunkAdvertisement records (peer + timestamp ordering); ChunkRequestRouter resolves a chunk request to the lowest-latency holder via injected LatencyOracle, falling back to the configured server when no mesh peer holds the chunk; RedundancyManager enforces the per-chunk redundancyTarget (configurable preset map for critical / shared / user-content / telemetry classes), detects peer departures via the bus, and emits ReplicationTask orders with deterministic replacement-holder selection; IntegrityVerifier runs an injected HashFn (SHA-256 by default; BLAKE3 plug-compatible) over received chunk bytes, blacklists senders that ship corrupted chunks for a TTL window, and exposes a clear-text trust map for downstream observability. Wrapped in a single ContentDeliveryPlugin satisfying the NetworkPlugin lifecycle.

Documentation tree

- [chunk-index](./src/index/chunk-index.md) — _(no submodules)_- [integrity](./src/integrity/integrity-verifier.md) — _(no submodules)_- [integrity-verifier](./src/integrity/integrity-verifier.md) — _(no submodules)_- [packer](./src/packer/packer-integration.md) — _(no submodules)_- [packer-integration](./src/packer/packer-integration.md) — _(no submodules)_- [plugin](./src/plugin/content-delivery-plugin.md) — _(no submodules)_- [content-delivery-plugin](./src/plugin/content-delivery-plugin.md) — _(no submodules)_- [prefetch](./src/prefetch/prefetch-engine.md) — _(no submodules)_- [prefetch-engine](./src/prefetch/prefetch-engine.md) — _(no submodules)_- [redundancy](./src/redundancy/redundancy-manager.md) — _(no submodules)_- [redundancy-manager](./src/redundancy/redundancy-manager.md) — _(no submodules)_- [router](./src/router/chunk-request-router.md) — _(no submodules)_- [chunk-request-router](./src/router/chunk-request-router.md) — _(no submodules)_- [store](./src/store/chunk-store.md) — _(no submodules)_- [chunk-store](./src/store/chunk-store.md) — _(no submodules)_- [throttle](./src/throttle/bandwidth-throttler.md) — _(no submodules)_- [bandwidth-throttler](./src/throttle/bandwidth-throttler.md) — _(no submodules)_- [error-codes](./src/error-codes.md) — Frozen `NET_CD` error registry for `@suaveplan/network-plugin-content-delivery`. Every failure path the content-deliver…

Modules

  • index/chunk-index — distributed holder map.
  • router/chunk-request-router — latency-aware request routing.
  • redundancy/redundancy-manager — N-copy enforcement + re-replication.
  • integrity/integrity-verifier — hash verification + sender blacklisting.
  • packer/packer-integration — adapts @suaveplan/packer output into ChunkManifest and broadcasts cd:manifest.
  • store/chunk-store — local chunk persistence over a pluggable ChunkStoreAdapter (@suaveplan/drive in production) with TTL + LRU eviction; emits cd:chunk-stored / cd:chunk-evicted.
  • prefetch/prefetch-engine — proactive fetch path with pluggable PredictionModel and session-scoped fan-out; emits cd:prefetch-issued.
  • throttle/bandwidth-throttler — per-peer + global token-bucket throttling tagging every admitted dispatch with priority: "bulk"; emits cd:throttled.
  • plugin/content-delivery-plugin — NetworkPlugin facade wiring every subsystem.