46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
/// <reference types="node" />
|
|
/// <reference types="node" />
|
|
import EventEmitter from "events";
|
|
import DHTFlood from "@lumeweb/dht-flood";
|
|
export default class DHTCache extends EventEmitter {
|
|
protected swarm: any;
|
|
private id;
|
|
private bootstrapped;
|
|
private graph;
|
|
private connectedTo;
|
|
protected flood: DHTFlood;
|
|
constructor(swarm: any, { id, ...opts }?: {
|
|
id?: Buffer;
|
|
[key: string]: any;
|
|
});
|
|
private _cache;
|
|
get cache(): {};
|
|
get all_cache(): string[];
|
|
addItem(item: string | Buffer): void;
|
|
private _compileMessage;
|
|
private _broadcastMessage;
|
|
removeItem(item: string | Buffer): boolean;
|
|
private _online;
|
|
get online(): Set<string>;
|
|
broadcast(message: any, ttl?: number): void;
|
|
send(message: any): void;
|
|
protected addPeerHandler(peer: any): void;
|
|
removePeerHandler(peer: any): void;
|
|
protected onRemovePeer(peer: any): void;
|
|
protected onGetBroadcast(message: Buffer, id: Buffer): void;
|
|
private _signItem;
|
|
private _setEntity;
|
|
private _ensureItem;
|
|
private _ensurePeer;
|
|
private _ensureEntity;
|
|
private _hasSeenEntity;
|
|
private _addEntityConnection;
|
|
private _removeEntityConnection;
|
|
private _removeEntity;
|
|
private _bootstrapFrom;
|
|
private _getBootstrapInfo;
|
|
private _recalculate;
|
|
private _maybeHexify;
|
|
private _pruneItems;
|
|
}
|
|
//# sourceMappingURL=index.d.ts.map
|