class Peer
implements IPeer
Re-export
import { Peer } from "https://deno.land/x/earthstar@v9.3.3/src/entries/npm.ts";
Holds many shares' replicas and manages their synchronisation with other peers. Recommended as the point of contact between your application and Earthstar shares.
Properties
private
httpSyncer: Syncer<TransportHttpClient<SyncerBag>> | nullprivate
localSyncer: Syncer<TransportLocal<SyncerBag>> | nullprivate
targetLocalSyncers: Map<string, Syncer<TransportLocal<SyncerBag>>>private
websocketSyncer: Syncer<TransportWebsocketClient<SyncerBag>> | nullpeerId: PeerId
replicaMap: SuperbusMap<ShareAddress, IReplica>
A subscribable map of the replicas stored in this peer.
syncerStatuses: SuperbusMap<string, Record<ShareAddress, SyncSessionStatus>>
A subscribable map of each of this Peer's sync operations' statuses
Methods
private
addOrGetHttpSyncer(): Syncer<TransportHttpClient<SyncerBag>>private
addOrGetLocalSyncer(): Syncer<TransportLocal<SyncerBag>>private
subscribeSyncerStatuses<TransportType extends ITransport<SyncerBag>>(syncer: Syncer<TransportType>)addReplica(replica: IReplica): Promise<void>
getReplica(ws: ShareAddress): IReplica | undefined
removeReplica(replica: IReplica): Promise<void>
size(): number
Stop all synchronisations.
syncUntilCaughtUp(targets: (IPeer | string)[])
Sync with many peers until there is nothing left to pull, and then stops.