(staged as /lib/init/init-main.js); point bundle-kernel-init and verify scripts at the new path. Wire curl, wget, openssl, ssh-keygen, and tar through coreutils and booter host delegates with booter-side CLI helpers; refresh related bins, bare manifest, shell completion, and man DB (kernel + seeder). Add booter support modules for ACL evaluation, audit chain, secret handles, peer admission, replication priority, process table, swarm lifecycle, boot-graph proc, metrics, monotonic time, protomux alias registry, and swarm peer policy; extend extension resolver, VFS, swarm connection managers, IPC, identity-account, and initd. Harden bare-os-bare-libs build on esbuild failure; add verify scripts for extension manifest schema and runtime incomplete markers; extend ctx API typings, gen-ctx-client-stub, and verify-ctx-dts. Update boot hook fragment, bundled init.js, handbook and reference docs (incl. kernel security and VFS path classes).
70 lines
1.5 KiB
JavaScript
70 lines
1.5 KiB
JavaScript
/**
|
|
* Swarm connection manager: delegates to {@link BareOsSwarmPeerPolicyEngine} for
|
|
* peer health, scoring, backoff/ban windows, and replication scheduling hints.
|
|
*/
|
|
|
|
import { BareOsSwarmPeerPolicyEngine } from './bare-os-swarm-peer-policy.js'
|
|
|
|
export class BareOsSwarmConnectionManager {
|
|
/**
|
|
* @param {import('hyperswarm').default | null} swarm
|
|
* @param {{ env?: Record<string, string | undefined> | null }} [opts]
|
|
*/
|
|
constructor(swarm, opts = {}) {
|
|
this._engine = new BareOsSwarmPeerPolicyEngine(swarm, opts)
|
|
}
|
|
|
|
get swarm() {
|
|
return this._engine.swarm
|
|
}
|
|
|
|
/**
|
|
* @param {string} peerKey
|
|
* @param {boolean} ok
|
|
* @param {{ latencyMs?: number }} [probeMeta]
|
|
*/
|
|
noteProbe(peerKey, ok, probeMeta) {
|
|
this._engine.noteProbe(peerKey, ok, probeMeta)
|
|
}
|
|
|
|
/**
|
|
* @param {string} peerKey
|
|
*/
|
|
shouldAttemptPeer(peerKey) {
|
|
return this._engine.shouldAttemptPeer(peerKey)
|
|
}
|
|
|
|
/**
|
|
* @param {string} peerKey
|
|
*/
|
|
consumeReconnectBudget(peerKey) {
|
|
this._engine.consumeReconnectBudget(peerKey)
|
|
}
|
|
|
|
/**
|
|
* @param {string} peerKey
|
|
* @param {number} [amount]
|
|
*/
|
|
replenishReconnectBudget(peerKey, amount) {
|
|
this._engine.replenishReconnectBudget(peerKey, amount)
|
|
}
|
|
|
|
/**
|
|
* @param {string} peerKey
|
|
*/
|
|
score(peerKey) {
|
|
return this._engine.score(peerKey)
|
|
}
|
|
|
|
snapshot() {
|
|
return this._engine.snapshot()
|
|
}
|
|
|
|
/**
|
|
* @param {string[]} peerKeys
|
|
*/
|
|
rankPeers(peerKeys) {
|
|
return this._engine.rankPeers(peerKeys)
|
|
}
|
|
}
|