import type { DisjointPath } from './index.js'; import type { AbortOptions, PeerId, PeerInfo } from '@libp2p/interface'; interface PeerDistance { peer: PeerInfo; distance: Uint8Array; path: DisjointPath; } /** * Maintains a list of peerIds sorted by distance from a DHT key. */ export declare class PeerDistanceList { /** * The DHT key from which distance is calculated */ private readonly originDhtKey; /** * The maximum size of the list */ private readonly capacity; private peerDistances; constructor(originDhtKey: Uint8Array, capacity: number); /** * The length of the list */ get length(): number; /** * The peers in the list, in order of distance from the origin key */ get peers(): PeerDistance[]; /** * Add a peerId to the list. */ add(peer: PeerInfo, path?: DisjointPath, options?: AbortOptions): Promise; /** * Add a peerId to the list. */ addWithKadId(peer: PeerInfo, kadId: Uint8Array, path?: DisjointPath): void; /** * Indicates whether any of the peerIds passed as a parameter are closer * to the origin key than the furthest peerId in the PeerDistanceList. */ isCloser(peerId: PeerId, options?: AbortOptions): Promise; /** * Indicates whether any of the peerIds passed as a parameter are closer * to the origin key than the furthest peerId in the PeerDistanceList. */ anyCloser(peerIds: PeerId[], options?: AbortOptions): Promise; } export {}; //# sourceMappingURL=peer-distance-list.d.ts.map