libp2p
    Preparing search index...

    Interface PeerStore

    interface PeerStore {
        all(query?: PeerQuery): Promise<Peer[]>;
        consumePeerRecord(
            buf: Uint8Array,
            options?: ConsumePeerRecordOptions,
        ): Promise<boolean>;
        consumePeerRecord(
            buf: Uint8Array,
            expectedPeer?: PeerId,
            options?: AbortOptions,
        ): Promise<boolean>;
        delete(peerId: PeerId, options?: AbortOptions): Promise<void>;
        forEach(fn: (peer: Peer) => void, query?: PeerQuery): Promise<void>;
        get(peerId: PeerId, options?: AbortOptions): Promise<Peer>;
        getInfo(peerId: PeerId, options?: AbortOptions): Promise<PeerInfo>;
        has(peerId: PeerId, options?: AbortOptions): Promise<boolean>;
        merge(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer>;
        patch(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer>;
        save(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer>;
    }
    Index

    Methods

    • Loop over every peer - the looping is async because we read from a datastore but the peer operation is sync, this is to prevent long-lived peer operations causing deadlocks over the datastore which can happen if they try to access the peer store during the loop

      Parameters

      Returns Promise<void>

      await peerStore.forEach(peer => {
      // ...
      })