@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.
Files changed (53) hide show
  1. package/dist/src/checked-prune.d.ts.map +1 -1
  2. package/dist/src/checked-prune.js +12 -0
  3. package/dist/src/checked-prune.js.map +1 -1
  4. package/dist/src/index.d.ts +7 -13
  5. package/dist/src/index.d.ts.map +1 -1
  6. package/dist/src/index.js +81 -598
  7. package/dist/src/index.js.map +1 -1
  8. package/dist/src/instance-lifecycle.d.ts.map +1 -1
  9. package/dist/src/instance-lifecycle.js +9 -0
  10. package/dist/src/instance-lifecycle.js.map +1 -1
  11. package/dist/src/peer-session.d.ts.map +1 -1
  12. package/dist/src/peer-session.js +9 -0
  13. package/dist/src/peer-session.js.map +1 -1
  14. package/dist/src/pid.d.ts +0 -2
  15. package/dist/src/pid.d.ts.map +1 -1
  16. package/dist/src/pid.js +0 -5
  17. package/dist/src/pid.js.map +1 -1
  18. package/dist/src/replication-announcement.d.ts +3 -106
  19. package/dist/src/replication-announcement.d.ts.map +1 -1
  20. package/dist/src/replication-announcement.js +0 -521
  21. package/dist/src/replication-announcement.js.map +1 -1
  22. package/dist/src/replication-info-v2-receive.d.ts +14 -43
  23. package/dist/src/replication-info-v2-receive.d.ts.map +1 -1
  24. package/dist/src/replication-info-v2-receive.js +24 -199
  25. package/dist/src/replication-info-v2-receive.js.map +1 -1
  26. package/dist/src/replication-info-v2-send.d.ts +0 -1
  27. package/dist/src/replication-info-v2-send.d.ts.map +1 -1
  28. package/dist/src/replication-info-v2-send.js +0 -6
  29. package/dist/src/replication-info-v2-send.js.map +1 -1
  30. package/dist/src/replication.d.ts +0 -1
  31. package/dist/src/replication.d.ts.map +1 -1
  32. package/dist/src/replication.js +2 -17
  33. package/dist/src/replication.js.map +1 -1
  34. package/dist/src/role.d.ts +0 -4
  35. package/dist/src/role.d.ts.map +1 -1
  36. package/dist/src/role.js +0 -9
  37. package/dist/src/role.js.map +1 -1
  38. package/dist/src/sync/factory.d.ts +0 -1
  39. package/dist/src/sync/factory.d.ts.map +1 -1
  40. package/dist/src/sync/factory.js +20 -36
  41. package/dist/src/sync/factory.js.map +1 -1
  42. package/package.json +8 -8
  43. package/src/checked-prune.ts +12 -0
  44. package/src/index.ts +104 -817
  45. package/src/instance-lifecycle.ts +9 -0
  46. package/src/peer-session.ts +9 -0
  47. package/src/pid.ts +0 -6
  48. package/src/replication-announcement.ts +8 -739
  49. package/src/replication-info-v2-receive.ts +25 -271
  50. package/src/replication-info-v2-send.ts +0 -7
  51. package/src/replication.ts +1 -20
  52. package/src/role.ts +0 -13
  53. package/src/sync/factory.ts +24 -38
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peerbit/shared-log",
3
- "version": "15.0.0",
3
+ "version": "16.0.1",
4
4
  "description": "Shared log",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -63,22 +63,22 @@
63
63
  "pino": "^9.4.0",
64
64
  "uint8arrays": "^5.1.0",
65
65
  "@peerbit/any-store": "2.2.14",
66
- "@peerbit/blocks": "4.2.10",
67
66
  "@peerbit/blocks-interface": "2.1.5",
67
+ "@peerbit/blocks": "4.2.10",
68
68
  "@peerbit/crypto": "3.1.5",
69
69
  "@peerbit/cache": "3.1.1",
70
70
  "@peerbit/diagnostics": "0.0.1",
71
71
  "@peerbit/indexer-interface": "3.0.9",
72
- "@peerbit/log": "6.2.17",
72
+ "@peerbit/pubsub": "5.4.1",
73
+ "@peerbit/indexer-sqlite3": "3.0.14",
73
74
  "@peerbit/logger": "2.0.1",
74
75
  "@peerbit/program": "6.0.49",
75
- "@peerbit/indexer-sqlite3": "3.0.14",
76
76
  "@peerbit/pubsub-interface": "5.2.1",
77
- "@peerbit/pubsub": "5.4.1",
78
77
  "@peerbit/riblt": "1.2.0",
79
78
  "@peerbit/rpc": "6.1.17",
80
79
  "@peerbit/stream-interface": "6.0.15",
81
- "@peerbit/time": "3.0.1"
80
+ "@peerbit/time": "3.0.1",
81
+ "@peerbit/log": "6.2.17"
82
82
  },
83
83
  "optionalDependencies": {
84
84
  "@peerbit/native-backbone": "0.2.5",
@@ -89,9 +89,9 @@
89
89
  "@types/pidusage": "^2.0.5",
90
90
  "uuid": "^11.1.1",
91
91
  "@peerbit/any-store-rust": "0.1.4",
92
+ "@peerbit/indexer-rust": "1.0.7",
92
93
  "@peerbit/test-utils": "3.1.23",
93
- "peerbit": "5.3.23",
94
- "@peerbit/indexer-rust": "1.0.7"
94
+ "peerbit": "5.3.23"
95
95
  },
96
96
  "repository": {
97
97
  "type": "git",
@@ -76,6 +76,14 @@ export class CheckedPruneCoordinator<T, R extends "u32" | "u64"> {
76
76
  readonly retries = new Map<string, CheckedPruneRetryState<T, R>>();
77
77
  private readonly sessions = new Map<string, CheckedPruneSession<T, R>>();
78
78
  private readonly grantSends = new Map<string, Set<Promise<void>>>();
79
+ // Per-peer refcount of in-flight removal fences; while non-zero the peer is
80
+ // withheld from the exact-replicator set (see fencePeerRemoval /
81
+ // isPeerRemovalFenced).
82
+ //
83
+ // PERMANENT (fence census closed NO-GO 2026-08-12): a concurrency-DEPTH
84
+ // refcount held across removal lanes that may span a peer reconnect, so
85
+ // neither a session token (it would reset mid-drain) nor lifecycle identity
86
+ // (it cannot count open lanes) can replace it.
79
87
  private readonly peerRemovalFences = new Map<string, number>();
80
88
  private readonly restartReservations = new Map<string, object>();
81
89
  private readonly candidateTokens = new Map<string, object>();
@@ -88,6 +96,10 @@ export class CheckedPruneCoordinator<T, R extends "u32" | "u64"> {
88
96
  // a fresh coordinator); deliberately NOT touched by close() — the release
89
97
  // closures drain it, matching the legacy host counter which was reset
90
98
  // only at open.
99
+ //
100
+ // PERMANENT (fence census closed NO-GO 2026-08-12): a concurrency-DEPTH
101
+ // counter of re-entrant removals — identity tells you which coordinator a
102
+ // continuation started under, never how many removals are in flight now.
91
103
  private _checkedPruneRemoveBlocksLocalRangeMutationAdmission = 0;
92
104
 
93
105
  /** ≡ the legacy inc / `finally`-dec pair around the admitted lower-log