Skip to main content
Module

x/earthstar/src/syncer/sync_agent.ts>SyncAgent

Earthstar is a tool for private, undiscoverable, offline-first networks.
Go to Latest
class SyncAgent
import { SyncAgent } from "https://deno.land/x/earthstar@v10.0.0-beta.6/src/syncer/sync_agent.ts";

Mediates synchronisation on behalf of a Replica.

Constructors

new
SyncAgent(opts: SyncAgentOpts<F>)

Properties

private
gossiperInboundQueue: AsyncQueue<SyncAgentEvent>
private
hasPrepared
private
hasReconciled
private
inboundEventQueue: AsyncQueue<SyncAgentEvent>

Messages coming in from the other peer

private
isDoneMultiDeferred: MultiDeferred<void>

A multi deferred describing if th the SyncAgent has finished or not.

private
outboundEventQueue: AsyncQueue<SyncAgentEvent>

Messages generated from us destined for the other peer.

private
receivedDocsCount: number
private
reconcilerInboundQueue: AsyncQueue<RangeMessage>
private
requestedCount: number
private
sentDocsCount: number
private
statusBus: BlockingBus<SyncAgentStatus>

A bus we can update the SyncAgent's status from, and which others can subscribe to.

counterpartId

An internal ID we use to distinguish messages from the agent we're syncing with from other messages and docs.

replica: Replica

Methods

cancel(reason?: string)

Signal the SyncAgent to wrap up syncing early.

events(): AsyncIterable<SyncAgentEvent>

The current status of this SyncAgent

onStatusUpdate(callback: (status: SyncAgentStatus) => void)

Subscribe to status updates with a callback.