54 lines
1.7 KiB
TypeScript
54 lines
1.7 KiB
TypeScript
/// <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;
|
|
private heartBeatInterval;
|
|
protected flood: DHTFlood;
|
|
private log;
|
|
constructor(swarm: any, { id, heartBeatInterval, ...opts }?: {
|
|
id?: Buffer;
|
|
[key: string]: any;
|
|
});
|
|
private _cache;
|
|
get cache(): string[];
|
|
get allCache(): string[];
|
|
peerHasItem(peer: string | Buffer, item: string | Buffer): boolean;
|
|
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(peer: any, 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;
|
|
private _heartbeatCheck;
|
|
private _emitHeartbeat;
|
|
private _hello;
|
|
private _sendItemsToPeer;
|
|
private _createAddItemRequestMessage;
|
|
private _createAddItemRequest;
|
|
}
|
|
//# sourceMappingURL=index.d.ts.map
|