@suaveplan/network-plugin-registry - Fixed-capacity peer registry with bitpacker-based binary message encoding
Summary
Fixed-capacity peer registry with bitpacker-based binary encoding.
Documentation tree
- encoder — (no submodules)
- encoder — (no submodules)
- registry — (no submodules)
- registry — (no submodules)
- sync — (no submodules)
- sync — (no submodules)
- error-codes — Defines the stable error-code registry for the
@suaveplan/network-plugin-registrypackage. All runtime failures withi… - registry-plugin — Integrates the registry system into a
NetworkNode.RegistryPluginimplementsNetworkPluginand wires together the…
- registry-plugin — Integrates the registry system into a
NetworkNode.RegistryPluginimplementsNetworkPluginand wires together the… - encoder — (no submodules)- registry — (no submodules)- registry — (no submodules)- sync — (no submodules)- sync — (no submodules)- error-codes — Defines the stable error-code registry for the
@suaveplan/network-plugin-registrypackage. All runtime failures withi… - registry-plugin — Integrates the registry system into a
NetworkNode.RegistryPluginimplementsNetworkPluginand wires together the… - encoder — (no submodules)- registry — (no submodules)- registry — (no submodules)- sync — (no submodules)- sync — (no submodules)- error-codes — Defines the stable error-code registry for the
@suaveplan/network-plugin-registrypackage. All runtime failures withi… - registry-plugin — Integrates the registry system into a
NetworkNode.RegistryPluginimplementsNetworkPluginand wires together the… - encoder — (no submodules)- registry — (no submodules) - registry — (no submodules)- sync — (no submodules) - sync — (no submodules)- error-codes — Defines the stable error-code registry for the
@suaveplan/network-plugin-registrypackage. All runtime failures withi… - registry-plugin — Integrates the registry system into a
NetworkNode.RegistryPluginimplementsNetworkPluginand wires together the…
Purpose
Manages a small, fixed-capacity registry of mesh peers. Provides CRUD operations, compact binary encoding via @suaveplan/bitpacker, and periodic sync to the network bus. This plugin is essential for mesh membership tracking and peer discovery.
Features
- Registry — fixed-capacity peer storage with add/remove/get/list
- BinaryMessageEncoder — bitpacker-based encoding, target ≤ 62 bytes
- RegistrySyncManager — periodic
registry:updatebus events - RegistryPlugin — integrates everything into
NetworkNode
Usage
Basic Example
import { RegistryPlugin } from "@suaveplan/network-plugin-registry";
const plugin = new RegistryPlugin(32);
node.use(plugin);
plugin.registry.add({ peerId: "p1", address: "10.0.0.1", tier: 1, latencyMs: 5 });
Advanced Example
import { Registry, BinaryMessageEncoder } from "@suaveplan/network-plugin-registry";
const registry = new Registry(16);
const encoder = new BinaryMessageEncoder();
registry.add(peer);
const bytes = encoder.encode(peer);
API Reference
See per-module documentation in src/:
src/registry/—Registry,PeerEntrysrc/encoder/—BinaryMessageEncodersrc/sync/—RegistrySyncManagersrc/registry-plugin.ts—RegistryPlugin
Implementation Notes
The registry uses a Map for O(1) operations. Capacity is strictly enforced. The binary encoder uses a @suaveplan/bitpacker schema for tier (8 bits), latency (16 bits), and address length (8 bits). The 62-byte limit ensures registry messages are small enough for high-frequency updates.