ipfs-bitswap
Version:
JavaScript implementation of the Bitswap data exchange protocol used by IPFS
27 lines • 864 B
TypeScript
import { Wantlist } from '../wantlist/index.js';
import type { Message } from '../message/message.js';
import type { WantListEntry } from '../wantlist/entry.js';
import type { PeerId } from '@libp2p/interface';
import type { CID } from 'multiformats/cid';
export declare class Ledger {
partner: PeerId;
wantlist: Wantlist;
exchangeCount: number;
accounting: {
bytesSent: number;
bytesRecv: number;
};
lastExchange?: number;
constructor(peerId: PeerId);
sentBytes(n: number): void;
receivedBytes(n: number): void;
wants(cid: CID, priority: number, wantType: Message.Wantlist.WantType): void;
/**
* @param {CID} cid
* @returns {void}
*/
cancelWant(cid: CID): void;
wantlistContains(cid: CID): WantListEntry | undefined;
debtRatio(): number;
}
//# sourceMappingURL=ledger.d.ts.map