Skip to main content
Module

x/earthstar/src/syncer/sync-coordinator.ts>SyncCoordinator

A specification and Javascript library for building online tools you can truly call your own.
Go to Latest
class SyncCoordinator
import { SyncCoordinator } from "https://deno.land/x/earthstar@v9.3.3/src/syncer/sync-coordinator.ts";

Orchestrates different requests in order to syncrhronise a Peer using a connection

Constructors

new
SyncCoordinator(peer: Peer, connection: IConnection<SyncerBag>)

Properties

private
connection: IConnection<SyncerBag>
private
peerReplicaMapUnsub: () => void
private
pullTimeouts: Map<string, number>
private
shareStates: Record<ShareAddress, ShareState>
private
syncerBag: SyncerBag
readonly
commonShares

The shares which this SyncCoordinator has in common with the peer at the other end of the connection.

partnerLastSeenAt: number | null
state: "ready" | "active" | "closed"

A subscribable map of shares and the status of their synchronisation operations.

Methods

private
mergeShareStates(newShareStates: Record<string, ShareState>)
pull(shareAddress: string)

Start the coordinator - establish common shares and begin pulling

storageCaughtUp(storageId: string, isCaughtUp: boolean)