Files
bare-operating-system/packages/bare-os-booter/lib/bare-os-replication-proc-live.js
T
Raven Scott c15e8fa5be feat(booter): POSIX/P2P roadmap — profile 1.0.14, ctx 1.50.0, docs & tests
- Sync declared POSIX profile, compliance matrix, syscalls examples, dashboard
- Extend holepunch clone sync reporting; bump protomux/hyperswarm lock fixture schema
- Optional shell read builtin (BARE_OS_SHELL_READ_*); host env passthrough
- Expand bareOsGetconfSysconf / getconf; pathconf for acct/union/mirror
- Wasm optional bare_os_monotonic_ms; replication live snapshot hints schema
- Socket bridge SO_RCVBUF/SO_SNDBUF; mq priority + FIFO ordering + tests
- Extract cooperative fcntl lock helpers; FIFO waiter drain tests
- Peer admission audit helpers, rate limit + redaction tests; security_posture schema
- CI: verify-ctx requires CHANGELOG row, d.ts version mention, compatibility matrix
- Warm-cache microbench (vfs suite); boot budget / metrics cohesion (prior work)
- Handbook, KERNEL_CONTRACT, kernel-program, env appendix, README, users-manual, schemas

Kernel bundle + seeder rsync + coreutils build verified via npm test.
2026-04-05 13:50:07 -04:00

57 lines
1.8 KiB
JavaScript

/**
* Live Hyperdrive / core length hints for `/proc/bare_os/replication` and
* `metrics_live.replicationLive` (non-secret progress; not full per-peer throughput).
*
* @param {{ drive?: unknown, personalDrive?: unknown } | null | undefined} disk
* @param {number} peerCount
*/
export function buildBareOsReplicationLiveSketch(disk, peerCount) {
let systemCoreLength = null
let personalCoreLength = null
try {
const c =
disk &&
disk.drive &&
/** @type {{ core?: { length?: number } }} */ (disk.drive).core
if (c && typeof c.length === 'number') systemCoreLength = c.length
} catch {
systemCoreLength = null
}
try {
const c =
disk &&
disk.personalDrive &&
/** @type {{ core?: { length?: number } }} */ (disk.personalDrive).core
if (c && typeof c.length === 'number') personalCoreLength = c.length
} catch {
personalCoreLength = null
}
let auxiliaryDriveCount = 0
try {
if (disk && Array.isArray(disk.auxiliaryDrives))
auxiliaryDriveCount = disk.auxiliaryDrives.length
} catch {
auxiliaryDriveCount = 0
}
const stallHint =
peerCount === 0
? 'no_peers'
: systemCoreLength == null
? 'length_unavailable'
: 'ok'
return {
schema: 3,
systemCoreLength,
personalCoreLength,
auxiliaryDriveCount,
stallHint,
corestoreSnapshotSurface: {
schema: 1,
operatorWorkflow:
'Pause or quiesce writers → replicate cores → export snapshot (corestore-snapshot style). Guest **`guestSuspendResume`** remains **ENOTSUP** unless the host registers Corestore suspend/resume hooks.',
readOnly: true
},
note: 'Schema 3 keeps schema 2 fields and adds corestoreSnapshotSurface (operator hints only). Append-only core lengths are non-secret progress hints — not a full telemetry plane.'
}
}