Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

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

Storage for private, distributed, offline-first applications.
Go to Latest
class SyncAgent
import { SyncAgent } from "https://deno.land/x/earthstar@v10.2.2/src/syncer/sync_agent.ts";

Mediates synchronisation on behalf of a Replica.

Constructors

new
SyncAgent(opts: SyncAgentOpts<F>)

Properties

private
gossiperInboundQueue: AsyncQueue<SyncAgentEvent>
private
hasCheckedAllExistingDocsForAttachments
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.