libp2p
Version:
JavaScript implementation of libp2p, a modular peer to peer network stack
41 lines • 1.68 kB
TypeScript
import type { AbortOptions, ComponentLogger, ContentRouting, Metrics, PeerInfo, PeerRouting, PeerStore, RoutingOptions, Startable } from '@libp2p/interface';
import type { CID } from 'multiformats/cid';
export interface CompoundContentRoutingInit {
routers: ContentRouting[];
}
export interface CompoundContentRoutingComponents {
peerStore: PeerStore;
peerRouting: PeerRouting;
logger: ComponentLogger;
metrics?: Metrics;
}
export declare class CompoundContentRouting implements ContentRouting, Startable {
private readonly routers;
private started;
private readonly components;
constructor(components: CompoundContentRoutingComponents, init: CompoundContentRoutingInit);
readonly [Symbol.toStringTag] = "@libp2p/content-routing";
isStarted(): boolean;
start(): Promise<void>;
stop(): Promise<void>;
/**
* Iterates over all content routers in parallel to find providers of the given key
*/
findProviders(key: CID, options?: RoutingOptions): AsyncGenerator<PeerInfo>;
/**
* Iterates over all content routers in parallel to notify it is
* a provider of the given key
*/
provide(key: CID, options?: AbortOptions): Promise<void>;
cancelReprovide(key: CID, options?: AbortOptions): Promise<void>;
/**
* Store the given key/value pair in the available content routings
*/
put(key: Uint8Array, value: Uint8Array, options?: AbortOptions): Promise<void>;
/**
* Get the value to the given key.
* Times out after 1 minute by default.
*/
get(key: Uint8Array, options?: AbortOptions): Promise<Uint8Array>;
}
//# sourceMappingURL=content-routing.d.ts.map