import { PeerId, CID, Block, Await, BigInteger, AbortOptions } from './basic'; import { MovingAverage } from './moving-avarage'; import { StoreReader, StoreExporter, StoreImporter } from './store'; export interface Bitswap extends StoreReader, StoreExporter, StoreImporter { readonly peerId: PeerId; enableStats(): void; disableStats(): void; wantlistForPeer(peerId: PeerId, options?: AbortOptions): Map; ledgerForPeer(peerId: PeerId): Ledger; put(block: Block, options?: AbortOptions): Await; unwant(cids: Iterable, options?: AbortOptions): void; cancelWants(cids: Iterable): void; getWantlist(options?: AbortOptions): Iterable<[string, WantListEntry]>; peers(): PeerId[]; stat(): Stats; start(): void; stop(): void; } export interface Ledger { sentBytes(n: number): void; receivedBytes(n: number): void; wants(cid: CID, priority: number, wantType: WantType): void; cancelWant(cid: CID): void; wantlistContains(cid: CID): WantListEntry | void; debtRatio(): number; } export interface WantListEntry { readonly cid: CID; priority: number; inc(): void; dec(): void; hasRefs(): boolean; equals(other: WantListEntry): boolean; } export declare type WantList = { entries: Entry[]; full?: boolean; }; export declare type Entry = { block: Uint8Array; priority: number; cancel: boolean; wantType?: WantType; sendDontHave?: boolean; }; export declare type BlockPresence = { cid: Uint8Array; type: BlockPresenceType; }; export declare type Have = 0; export declare type DontHave = 1; export declare type BlockPresenceType = Have | DontHave; export declare type WantBlock = 0; export declare type HaveBlock = 1; export declare type WantType = WantBlock | HaveBlock; export declare type BlockData = { prefix: Uint8Array; data: Uint8Array; }; export interface Stats { enable(): void; disable(): void; stop(): void; readonly snapshot: Record; readonly movingAverages: Record>; push(counter: number, inc: number): void; } //# sourceMappingURL=bitswap.d.ts.map