@peerbit/shared-log 13.1.15 → 13.1.17

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 (39) hide show
  1. package/dist/benchmark/native-graph.d.ts +2 -0
  2. package/dist/benchmark/native-graph.d.ts.map +1 -0
  3. package/dist/benchmark/native-graph.js +249 -0
  4. package/dist/benchmark/native-graph.js.map +1 -0
  5. package/dist/benchmark/sync-batch-sweep.js +72 -24
  6. package/dist/benchmark/sync-batch-sweep.js.map +1 -1
  7. package/dist/benchmark/sync-phase-profile.d.ts +2 -0
  8. package/dist/benchmark/sync-phase-profile.d.ts.map +1 -0
  9. package/dist/benchmark/sync-phase-profile.js +303 -0
  10. package/dist/benchmark/sync-phase-profile.js.map +1 -0
  11. package/dist/src/checked-prune.d.ts +55 -0
  12. package/dist/src/checked-prune.d.ts.map +1 -0
  13. package/dist/src/checked-prune.js +244 -0
  14. package/dist/src/checked-prune.js.map +1 -0
  15. package/dist/src/index.d.ts +10 -9
  16. package/dist/src/index.d.ts.map +1 -1
  17. package/dist/src/index.js +285 -186
  18. package/dist/src/index.js.map +1 -1
  19. package/dist/src/sync/index.d.ts +9 -1
  20. package/dist/src/sync/index.d.ts.map +1 -1
  21. package/dist/src/sync/profile.d.ts +3 -0
  22. package/dist/src/sync/profile.d.ts.map +1 -0
  23. package/dist/src/sync/profile.js +2 -0
  24. package/dist/src/sync/profile.js.map +1 -0
  25. package/dist/src/sync/rateless-iblt.d.ts +25 -11
  26. package/dist/src/sync/rateless-iblt.d.ts.map +1 -1
  27. package/dist/src/sync/rateless-iblt.js +597 -106
  28. package/dist/src/sync/rateless-iblt.js.map +1 -1
  29. package/dist/src/sync/simple.d.ts +5 -0
  30. package/dist/src/sync/simple.d.ts.map +1 -1
  31. package/dist/src/sync/simple.js +224 -74
  32. package/dist/src/sync/simple.js.map +1 -1
  33. package/package.json +16 -12
  34. package/src/checked-prune.ts +331 -0
  35. package/src/index.ts +451 -302
  36. package/src/sync/index.ts +11 -1
  37. package/src/sync/profile.ts +9 -0
  38. package/src/sync/rateless-iblt.ts +768 -128
  39. package/src/sync/simple.ts +256 -94
package/src/sync/index.ts CHANGED
@@ -7,6 +7,9 @@ import type { EntryWithRefs } from "../exchange-heads.js";
7
7
  import type { Numbers } from "../integers.js";
8
8
  import type { TransportMessage } from "../message.js";
9
9
  import type { EntryReplicated, ReplicationRangeIndexable } from "../ranges.js";
10
+ import type { SyncProfileFn } from "./profile.js";
11
+
12
+ export type { SyncProfileEvent, SyncProfileFn } from "./profile.js";
10
13
 
11
14
  export type SyncPriorityFn<R extends "u32" | "u64"> = (
12
15
  entry: EntryReplicated<R>,
@@ -14,7 +17,8 @@ export type SyncPriorityFn<R extends "u32" | "u64"> = (
14
17
 
15
18
  export type SyncOptions<R extends "u32" | "u64"> = {
16
19
  /**
17
- * Higher numbers are synced first.
20
+ * Orders entries inside a sync batch; higher numbers are selected first.
21
+ * This does not change the transport message priority/lane.
18
22
  * The callback should be fast and side-effect free.
19
23
  */
20
24
  priority?: SyncPriorityFn<R>;
@@ -48,6 +52,12 @@ export type SyncOptions<R extends "u32" | "u64"> = {
48
52
  * Larger values reduce orchestration overhead but increase per-target memory.
49
53
  */
50
54
  repairSweepTargetBufferSize?: number;
55
+
56
+ /**
57
+ * Optional profiling callback. It is only invoked when provided, and should
58
+ * avoid blocking because it runs inside sync hot paths.
59
+ */
60
+ profile?: SyncProfileFn;
51
61
  };
52
62
 
53
63
  export type SynchronizerComponents<R extends "u32" | "u64"> = {
@@ -0,0 +1,9 @@
1
+ export {
2
+ diagnosticStart as syncProfileStart,
3
+ emitDiagnosticDuration as emitSyncProfileDuration,
4
+ emitDiagnosticEvent as emitSyncProfileEvent,
5
+ } from "@peerbit/diagnostics";
6
+ export type {
7
+ DiagnosticEvent as SyncProfileEvent,
8
+ DiagnosticSink as SyncProfileFn,
9
+ } from "@peerbit/diagnostics";