class Peer
implements IPeer
import { Peer } from "https://deno.land/x/earthstar@v10.0.0-alpha.4/src/peer/peer.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
replicaEventBus: BlockingBus<Map<ShareAddress, Replica>>private
syncerManager: SyncerManagerreplicaMap: Map<ShareAddress, Replica>
A map of the replicas stored in this peer.
Methods
addReplica(replica: Replica): Promise<void>
addSyncPartner<I, F>(partner: ISyncPartner<I>, formats?: FormatsArg<F>)
Begin syncing using an instance implementing ISyncPartner
. Use this if you don't want to sync with a local peer or a replica server.
getReplica(ws: ShareAddress): Replica | undefined
onReplicasChange(callback: (map: Map<ShareAddress, Replica>) => void | Promise<void>)
Fires a given callback whenever the Peer's store of replicas changes.
removeReplica(replica: Replica): Promise<void>
size(): number
The number of replicas held by this peer