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

x/earthstar/src/entries/universal.ts>ISyncPartner

Storage for private, distributed, offline-first applications.
Go to Latest
interface ISyncPartner
Re-export
import { type ISyncPartner } from "https://deno.land/x/earthstar@v10.2.0/src/entries/universal.ts";

Provides a syncer with the means to connect the peer being synced with (the partner).

Type Parameters

IncomingAttachmentSourceType

Properties

syncAppetite: SyncAppetite
concurrentTransfers: number

The number of permitted concurrent attachment transfers

payloadThreshold: number

The size at which a subdivided reconciliation range should send a fingerprint instead of items. Must be at least 1.

A lower number mean fewer messages transmitted.

rangeDivision: number

The number of subdivisions to make when splitting a mismatched range. Must be at least 2.

Methods

getEvents(): AsyncIterable<SyncerEvent>

An async iterable of events from the partner.

sendEvent(event: SyncerEvent): Promise<void>

Sends a syncer event to the partner.

closeConnection(): Promise<void>
getDownload(opts: GetTransferOpts): Promise<ReadableStream<Uint8Array> | undefined | NotSupportedError>

Attempt to download an attachment directly from the partner.

handleUploadRequest(opts: GetTransferOpts): Promise<WritableStream<Uint8Array> | NotSupportedError>

Handles (usually in-band) request from the other peer to upload an attachment.

handleTransferRequest(source: IncomingAttachmentSourceType, kind: "upload" | "download"): Promise<
| ReadableStream<Uint8Array>
| WritableStream<Uint8Array>
| undefined
>

Handles an out-of-band request from the other peer to start a transfer.