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

x/earthstar/src/syncer/syncer_types.ts

Earthstar is a tool for private, undiscoverable, offline-first networks.
Go to Latest
import * as earthstar from "https://deno.land/x/earthstar@v10.0.0-alpha.2/src/syncer/syncer_types.ts";

Interfaces

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

A compressed description of a group of docs a sync agent possesses

Options to initialise a Syncer with.

  • peer - The peer to synchronise.
  • partner - Determines who you'll be syncing with (e.g. a remote peer on a server, a local peer)
  • mode - Determines what kind of sync to carry out.
  • formats - An optional array of formats to sync. Defaults to just es.5.

Type Aliases

Describes a group of docs under a common path which a syncing replica possesses.

A mode describing whether the HaveEntryKeeper should process only existing docs, or also live ones.

An event with an Earthstar document and corresponding ID.

A type of message one SyncAgent can send to another.

An event sent when a SyncAgent doesn't want anything anymore, though it'll still serve HAVE requests.

A hash of a replica's entire store of documents, used to quickly check equivalence.

Options used for initialisng a SyncAgent.

  • replica: The replica to represent.
  • mode: Whether to sync only existing docs or keep the connection open for new docs too.

The current status of a SyncAgent

  • requested: The number of documents requested
  • received: The number of requests responded to
  • status: An overall status of the agent. preparing is when it is calculating its HAVE entries, syncing when it has unfulfilled requests, idling when there are no active requests, and done when it has been closed, or received all documents it was interested in.

Signals that a SyncAgent wants a document/documents from another SyncAgent

An event for disclosing which shares a Peer has without actually revealing them. Another peer can use the salt to hash their own shares' addresses and see if they match.

An event a Syncer can send or receive.

A mode which determines when the syncer will stop syncing.

  • once - The syncer will only attempt to sync existing docs and then stop.
  • live - Indefinite syncing, including existing docs and new ones as they are ingested into the replica.

A map of sync statuses by the share address they're associated with.

A SyncAgentEvent addressed to a specific share address.