@optimystic/db-p2p 0.24.0 → 0.24.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 (29) hide show
  1. package/dist/src/cohort-topic/host.js +34 -11
  2. package/dist/src/cohort-topic/host.js.map +1 -1
  3. package/dist/src/cohort-topic/stream-util.d.ts +25 -11
  4. package/dist/src/cohort-topic/stream-util.d.ts.map +1 -1
  5. package/dist/src/cohort-topic/stream-util.js +31 -19
  6. package/dist/src/cohort-topic/stream-util.js.map +1 -1
  7. package/dist/src/matchmaking/query-transport.js +3 -3
  8. package/dist/src/matchmaking/query-transport.js.map +1 -1
  9. package/dist/src/reactivity/notify-transport.d.ts +4 -4
  10. package/dist/src/reactivity/notify-transport.js +6 -6
  11. package/dist/src/reactivity/notify-transport.js.map +1 -1
  12. package/dist/src/reactivity/push-state-gossip.js +2 -2
  13. package/dist/src/reactivity/push-state-gossip.js.map +1 -1
  14. package/dist/src/reactivity/recover-transport.d.ts +6 -2
  15. package/dist/src/reactivity/recover-transport.d.ts.map +1 -1
  16. package/dist/src/reactivity/recover-transport.js +7 -3
  17. package/dist/src/reactivity/recover-transport.js.map +1 -1
  18. package/dist/src/testing/cohort-topic-mesh-harness.d.ts +13 -6
  19. package/dist/src/testing/cohort-topic-mesh-harness.d.ts.map +1 -1
  20. package/dist/src/testing/cohort-topic-mesh-harness.js +15 -6
  21. package/dist/src/testing/cohort-topic-mesh-harness.js.map +1 -1
  22. package/package.json +3 -3
  23. package/src/cohort-topic/host.ts +2932 -2901
  24. package/src/cohort-topic/stream-util.ts +147 -135
  25. package/src/matchmaking/query-transport.ts +492 -492
  26. package/src/reactivity/notify-transport.ts +6 -6
  27. package/src/reactivity/push-state-gossip.ts +2 -2
  28. package/src/reactivity/recover-transport.ts +412 -408
  29. package/src/testing/cohort-topic-mesh-harness.ts +20 -10
@@ -7,10 +7,10 @@
7
7
  * who to dial and calls {@link ReactivityNotifyTransport.send} once per named target. This module owns only
8
8
  * the framing + dial + inbound-decode plumbing — no fan-out, no role decision, no gossip.
9
9
  *
10
- * The db-core `NotificationV1` codec ({@link encodeNotificationV1} / {@link decodeNotificationV1}) does the
11
- * length-prefixed JSON framing; this layer rides one self-delimiting frame each way over the notify
12
- * protocol, reusing the cohort-topic {@link sendOneWay} / {@link readAllBounded} stream lifecycle so the
13
- * two protocol families behave identically on the wire.
10
+ * The db-core `NotificationV1` codec ({@link encodeNotificationV1} / {@link decodeNotificationV1}) encodes
11
+ * the body; this layer rides one varint-length-prefixed frame each way over the notify protocol, reusing
12
+ * the cohort-topic {@link sendOneWay} / FRET `readFramed` stream lifecycle so the two protocol families
13
+ * behave identically on the wire.
14
14
  *
15
15
  * Failure isolation is the load-bearing property: notify is fire-and-forget and hint-only, so a dead /
16
16
  * unreachable target's rejection is swallowed (logged), never propagated to the caller's fan-out loop or a
@@ -23,7 +23,7 @@ import { encodeNotificationV1, decodeNotificationV1 } from "@optimystic/db-core"
23
23
  import type { Libp2p } from "libp2p";
24
24
  import type { Connection, Stream } from "@libp2p/interface";
25
25
  import { peerIdFromString } from "@libp2p/peer-id";
26
- import { readAllBounded } from "p2p-fret";
26
+ import { readFramed } from "p2p-fret";
27
27
  import { peerIdToBytes } from "../cohort-topic/peer-codec.js";
28
28
  import { sendOneWay, DEFAULT_STREAM_MAX_BYTES } from "../cohort-topic/stream-util.js";
29
29
  import { PROTOCOL_REACTIVITY_NOTIFY } from "./protocols.js";
@@ -129,7 +129,7 @@ export function registerNotifyHandler(
129
129
  void node.handle(protocol, (stream: Stream, connection: Connection) => {
130
130
  void (async (): Promise<void> => {
131
131
  try {
132
- const frame = await readAllBounded(stream, maxBytes);
132
+ const frame = await readFramed(stream, maxBytes);
133
133
  transport.deliver(connection.remotePeer.toString(), frame);
134
134
  await stream.close();
135
135
  } catch {
@@ -40,7 +40,7 @@ import {
40
40
  } from "@optimystic/db-core";
41
41
  import type { Libp2p } from "libp2p";
42
42
  import type { Connection, Stream } from "@libp2p/interface";
43
- import { readAllBounded } from "p2p-fret";
43
+ import { readFramed } from "p2p-fret";
44
44
  import type { FretCohortGossipTransport } from "../cohort-topic/cohort-gossip-transport.js";
45
45
  import { DEFAULT_GOSSIP_INTERVAL_MS } from "../cohort-topic/cohort-gossip-driver.js";
46
46
  import { DEFAULT_STREAM_MAX_BYTES } from "../cohort-topic/stream-util.js";
@@ -276,7 +276,7 @@ export function registerPushStateGossipHandler(
276
276
  void node.handle(protocol, (stream: Stream, connection: Connection) => {
277
277
  void (async (): Promise<void> => {
278
278
  try {
279
- const frame = await readAllBounded(stream, maxBytes);
279
+ const frame = await readFramed(stream, maxBytes);
280
280
  driver.deliver(connection.remotePeer.toString(), frame);
281
281
  await stream.close();
282
282
  } catch {