Skip to content
D
Documentation

UnreliableHub

reference
1 min readUpdated

Import it from @grafloria/engine.

Also has every member of MemoryHub, listed on its own entry.

A MemoryHub with the network's malice put back.

Same API, same adapters, same protocol — the ONLY difference is that this one behaves like the internet. If the sync layer is correct, nothing above it needs to change; if it is not, this is where you find out.

ts
class UnreliableHub extends MemoryHub

Properties

NameTypeDefaultDescription
faultsWhat the network actually did. Asserted on — a fuzz whose faults never fired is a lie.

Methods

  • constructor(options: UnreliableOptions = {})
  • override deliver(from: MemoryTransport, message: SyncMessage): void — Deliver to everyone EXCEPT the sender. A peer never hears its own echo.
  • step(fraction = 0.5): number — Release some of the in-flight queue, in a RANDOM order.

The random order is the point. A FIFO flush would only ever produce late delivery, and late-but-ordered is the easy case — the LWW gate handles it alone. Releasing out of order is what lets a set land before its add, which is the case that used to be unrecoverable and is the reason CausalBuffer exists.

  • heal(): void — Stop breaking things. The network has recovered; from here on it is a plain, honest bus. Anything still lost was lost DURING the storm, and anti-entropy — not the transport — is what has to find it.
  • settle(): void — Deliver everything still in flight.
  • get inFlightCount(): number
  • override connect(actor: ActorId): MemoryTransport

Was this page helpful?

UnreliableHub — Grafloria