Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/earthstar/src/syncer/syncer.ts>Syncer

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

Syncs the contents of a Peer's replicas with that of another peer's.

Type Parameters

IncomingTransferSourceType
optional
FormatsType = DefaultFormats

Properties

private
appetite: SyncAppetite
private
formats: FormatsArg<FormatsType>
private
heartbeatInterval: number
private
isDoneMultiDeferred: MultiDeferred
private
manager: SyncerManager
private
partnerIsFulfilled
private
statusBus: BlockingBus<SyncerStatus>
private
syncAgentQueues: Map<ShareAddress, AsyncQueue<SyncAgentEvent>>
private
syncAgents: Map<ShareAddress, SyncAgent<FormatsType>>
id
peer: IPeer

Methods

private
addShare(
address: string,
initiateMessaging: boolean,
)

Handle inbound events from the other peer.

cancel(reason?: any)

Stop syncing.

Get the status of all shares' syncing progress.

handleTransferRequest(unnamed 0: { shareAddress: string; formatName: string; path: Path; author: AuthorAddress; source: IncomingTransferSourceType; kind: "upload" | "download"; })

If the syncer was configured with the appetite: 'once', this promise will resolve when all the partner's existing documents and attachments have synchronised.

onStatusChange(callback: (status: SyncerStatus) => void): () => void

Fires the provided callback whenever any shares' syncing progress changes.