@peerbit/shared-log 16.0.13 → 16.0.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peerbit/shared-log",
3
- "version": "16.0.13",
3
+ "version": "16.0.14",
4
4
  "description": "Shared log",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -63,36 +63,36 @@
63
63
  "pino": "^9.4.0",
64
64
  "uint8arrays": "^5.1.0",
65
65
  "@peerbit/any-store": "2.2.15",
66
+ "@peerbit/blocks": "4.2.13",
66
67
  "@peerbit/blocks-interface": "2.1.6",
67
68
  "@peerbit/cache": "3.1.1",
68
- "@peerbit/blocks": "4.2.12",
69
69
  "@peerbit/crypto": "3.1.6",
70
70
  "@peerbit/diagnostics": "0.0.1",
71
71
  "@peerbit/indexer-interface": "3.0.12",
72
72
  "@peerbit/indexer-sqlite3": "3.0.18",
73
- "@peerbit/log": "6.2.23",
74
73
  "@peerbit/logger": "2.0.2",
75
- "@peerbit/program": "6.0.54",
76
74
  "@peerbit/pubsub": "5.4.2",
75
+ "@peerbit/log": "6.2.24",
76
+ "@peerbit/program": "6.0.55",
77
77
  "@peerbit/pubsub-interface": "5.2.2",
78
78
  "@peerbit/riblt": "1.2.0",
79
- "@peerbit/stream-interface": "6.0.16",
79
+ "@peerbit/rpc": "6.1.23",
80
80
  "@peerbit/time": "3.0.1",
81
- "@peerbit/rpc": "6.1.22"
81
+ "@peerbit/stream-interface": "6.0.16"
82
82
  },
83
83
  "optionalDependencies": {
84
- "@peerbit/shared-log-rust": "0.1.6",
85
- "@peerbit/native-backbone": "0.2.10"
84
+ "@peerbit/native-backbone": "0.2.10",
85
+ "@peerbit/shared-log-rust": "0.1.6"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@types/libsodium-wrappers": "^0.7.14",
89
89
  "@types/pidusage": "^2.0.5",
90
90
  "uuid": "^11.1.1",
91
91
  "@peerbit/indexer-rust": "1.0.13",
92
- "@peerbit/test-utils": "3.1.33",
93
- "@peerbit/any-store-rust": "0.1.4",
94
92
  "@peerbit/indexer-simple": "1.2.16",
95
- "peerbit": "5.3.33"
93
+ "@peerbit/test-utils": "3.1.34",
94
+ "@peerbit/any-store-rust": "0.1.5",
95
+ "peerbit": "5.3.34"
96
96
  },
97
97
  "repository": {
98
98
  "type": "git",
package/src/index.ts CHANGED
@@ -498,25 +498,36 @@ const joinNativeCoordinateDirectory = (
498
498
  `${nodeDirectory.replace(/[/\\]+$/, "")}/coordinates/${fsSafeLogId}`;
499
499
 
500
500
  type DurableBlockSublevelStore = {
501
+ readonly supportsCrashSafeJournalCheckpoint?: boolean;
501
502
  sublevel(
502
503
  name: string,
503
504
  options?: {
504
505
  compactOnClose?: boolean;
505
506
  compactOnCloseMinJournalBytes?: number;
507
+ compactMaxJournalBytes?: number;
506
508
  durability?: "normal" | "strict";
507
509
  },
508
510
  ): MaybePromise<AnyStore>;
509
511
  };
510
512
 
513
+ const defaultNativeEntryBlockCompactMaxJournalBytes = 64 * 1024 * 1024;
514
+
511
515
  const createNativeDurableBlockStore = async (
512
516
  storage: DurableBlockSublevelStore,
513
517
  ): Promise<AnyBlockStore> =>
514
518
  new AnyBlockStore(
515
519
  await storage.sublevel("blocks", {
516
- // Strict mirrors remain WAL-backed across close. The available snapshot
517
- // rewrite is not a crash-atomic generation protocol, so thresholds must
518
- // not re-enable it behind this acknowledgement boundary.
520
+ // Strict mirrors remain WAL-backed. On POSIX Node, checkpoint only the
521
+ // historical suffix through the Rust store's fsync + atomic-rename path;
522
+ // browsers/custom backends and Windows retain the prior unbounded WAL until
523
+ // they expose an equally strong directory durability barrier.
519
524
  compactOnClose: false,
525
+ ...(storage.supportsCrashSafeJournalCheckpoint === true
526
+ ? {
527
+ compactMaxJournalBytes:
528
+ defaultNativeEntryBlockCompactMaxJournalBytes,
529
+ }
530
+ : {}),
520
531
  // A native append is acknowledged only after this mirror resolves. The
521
532
  // Rust store's normal immutable fast path may resolve before its WAL write;
522
533
  // strict mode waits for the journal write and sync, closing the SIGKILL gap.