@peerbit/shared-log 15.0.0 → 16.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/checked-prune.d.ts.map +1 -1
- package/dist/src/checked-prune.js +12 -0
- package/dist/src/checked-prune.js.map +1 -1
- package/dist/src/index.d.ts +7 -13
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +81 -598
- package/dist/src/index.js.map +1 -1
- package/dist/src/instance-lifecycle.d.ts.map +1 -1
- package/dist/src/instance-lifecycle.js +9 -0
- package/dist/src/instance-lifecycle.js.map +1 -1
- package/dist/src/peer-session.d.ts.map +1 -1
- package/dist/src/peer-session.js +9 -0
- package/dist/src/peer-session.js.map +1 -1
- package/dist/src/pid.d.ts +0 -2
- package/dist/src/pid.d.ts.map +1 -1
- package/dist/src/pid.js +0 -5
- package/dist/src/pid.js.map +1 -1
- package/dist/src/replication-announcement.d.ts +3 -106
- package/dist/src/replication-announcement.d.ts.map +1 -1
- package/dist/src/replication-announcement.js +0 -521
- package/dist/src/replication-announcement.js.map +1 -1
- package/dist/src/replication-info-v2-receive.d.ts +14 -43
- package/dist/src/replication-info-v2-receive.d.ts.map +1 -1
- package/dist/src/replication-info-v2-receive.js +24 -199
- package/dist/src/replication-info-v2-receive.js.map +1 -1
- package/dist/src/replication-info-v2-send.d.ts +0 -1
- package/dist/src/replication-info-v2-send.d.ts.map +1 -1
- package/dist/src/replication-info-v2-send.js +0 -6
- package/dist/src/replication-info-v2-send.js.map +1 -1
- package/dist/src/replication.d.ts +0 -1
- package/dist/src/replication.d.ts.map +1 -1
- package/dist/src/replication.js +2 -17
- package/dist/src/replication.js.map +1 -1
- package/dist/src/role.d.ts +0 -4
- package/dist/src/role.d.ts.map +1 -1
- package/dist/src/role.js +0 -9
- package/dist/src/role.js.map +1 -1
- package/dist/src/sync/factory.d.ts +0 -1
- package/dist/src/sync/factory.d.ts.map +1 -1
- package/dist/src/sync/factory.js +20 -36
- package/dist/src/sync/factory.js.map +1 -1
- package/package.json +8 -8
- package/src/checked-prune.ts +12 -0
- package/src/index.ts +104 -817
- package/src/instance-lifecycle.ts +9 -0
- package/src/peer-session.ts +9 -0
- package/src/pid.ts +0 -6
- package/src/replication-announcement.ts +8 -739
- package/src/replication-info-v2-receive.ts +25 -271
- package/src/replication-info-v2-send.ts +0 -7
- package/src/replication.ts +1 -20
- package/src/role.ts +0 -13
- package/src/sync/factory.ts +24 -38
|
@@ -66,10 +66,19 @@ export class InstanceLifecycle {
|
|
|
66
66
|
// code. Incremented synchronously with leader-cache invalidation so the
|
|
67
67
|
// handler can detect whether its pre-join plan needs one fresh
|
|
68
68
|
// post-persist audit.
|
|
69
|
+
//
|
|
70
|
+
// PERMANENT (fence census closed NO-GO 2026-08-12): a sub-generation
|
|
71
|
+
// WITHIN one lifecycle — it advances while the lifecycle identity is
|
|
72
|
+
// deliberately unchanged, so an identity/session token cannot tell a
|
|
73
|
+
// pre-invalidation plan from a post-invalidation one.
|
|
69
74
|
public _receiveOwnershipRevision = 0;
|
|
70
75
|
// Count of ownership-changing range mutations from queue admission
|
|
71
76
|
// through settlement, including mutations already pending when a receive
|
|
72
77
|
// starts.
|
|
78
|
+
//
|
|
79
|
+
// PERMANENT (fence census closed NO-GO 2026-08-12): a concurrency-DEPTH
|
|
80
|
+
// refcount, not a staleness token — identity answers "which generation
|
|
81
|
+
// started this?", never "how many mutation lanes are open right now?".
|
|
73
82
|
public _receiveOwnershipMutationAdmissions = 0;
|
|
74
83
|
|
|
75
84
|
// ---- stage 4: physically owned controllers (moved from SharedLog) ----
|
package/src/peer-session.ts
CHANGED
|
@@ -131,6 +131,11 @@ export class PeerSessionRegistry {
|
|
|
131
131
|
// peer stays subscribed), and it must also fence a peer that never had a
|
|
132
132
|
// session. Unlike sessions this map IS cleared at _close (see
|
|
133
133
|
// clearReceiveEpochsForClose) and replaced at open.
|
|
134
|
+
//
|
|
135
|
+
// PERMANENT (fence census closed NO-GO 2026-08-12): the per-PEER lifetime
|
|
136
|
+
// above is the whole mechanism — a session token would rotate at exactly
|
|
137
|
+
// the moments this map must survive, and could not fence a session-less
|
|
138
|
+
// peer at all.
|
|
134
139
|
_replicationInfoReceiveEpochByPeer!: Map<string, object>;
|
|
135
140
|
// Moved from SharedLog (fence B6, same name — the sanctioned file-to-file
|
|
136
141
|
// ratchet move). Refcount of in-flight destructive peer cleanups: while
|
|
@@ -140,6 +145,10 @@ export class PeerSessionRegistry {
|
|
|
140
145
|
// reconnect may rotate the session; a fresh session with a zero gate
|
|
141
146
|
// would reopen receive admission mid-drain. The map instance is replaced
|
|
142
147
|
// only at open (resetForOpen) and cleared in place at _close.
|
|
148
|
+
//
|
|
149
|
+
// PERMANENT (fence census closed NO-GO 2026-08-12): both structural
|
|
150
|
+
// reasons at once — a concurrency-DEPTH refcount whose per-PEER lifetime
|
|
151
|
+
// deliberately spans the session rotation a reconnect causes mid-drain.
|
|
143
152
|
_receiveCleanupGateByPeer!: Map<string, number>;
|
|
144
153
|
// Moved from SharedLog (fence B5, same name). Peers whose replication-info
|
|
145
154
|
// is fenced: added when a departure/unsubscribe rotation or a reconnect
|
package/src/pid.ts
CHANGED
|
@@ -3,8 +3,6 @@ const MIN_MEMORY_HEADROOM_BALANCE_SCALER = 0.25;
|
|
|
3
3
|
export class PIDReplicationController {
|
|
4
4
|
integral!: number;
|
|
5
5
|
prevError!: number;
|
|
6
|
-
prevMemoryUsage!: number;
|
|
7
|
-
prevTotalFactor!: number;
|
|
8
6
|
kp: number;
|
|
9
7
|
ki: number;
|
|
10
8
|
kd: number;
|
|
@@ -42,9 +40,6 @@ export class PIDReplicationController {
|
|
|
42
40
|
let { memoryUsage, totalFactor, peerCount, cpuUsage, currentFactor } =
|
|
43
41
|
properties;
|
|
44
42
|
|
|
45
|
-
this.prevTotalFactor = totalFactor;
|
|
46
|
-
this.prevMemoryUsage = memoryUsage;
|
|
47
|
-
|
|
48
43
|
const estimatedTotalSize =
|
|
49
44
|
currentFactor > 0 ? memoryUsage / currentFactor : 1e5;
|
|
50
45
|
|
|
@@ -238,6 +233,5 @@ export class PIDReplicationController {
|
|
|
238
233
|
reset() {
|
|
239
234
|
this.prevError = 0;
|
|
240
235
|
this.integral = 0;
|
|
241
|
-
this.prevMemoryUsage = 0;
|
|
242
236
|
}
|
|
243
237
|
}
|