dht-cache/dist/index.d.ts

57 lines
1.8 KiB
TypeScript
Raw Normal View History

2022-11-24 01:39:45 +00:00
/// <reference types="node" />
2022-12-19 13:44:54 +00:00
/// <reference types="node" />
2022-11-24 01:39:45 +00:00
import EventEmitter from "events";
import DHTFlood from "@lumeweb/dht-flood";
2022-12-19 13:44:54 +00:00
import type { Logger } from "pino";
2022-11-24 01:39:45 +00:00
export default class DHTCache extends EventEmitter {
protected swarm: any;
private id;
private bootstrapped;
private graph;
private connectedTo;
2022-12-05 20:14:12 +00:00
private heartBeatInterval;
2022-11-24 01:39:45 +00:00
protected flood: DHTFlood;
2022-12-07 06:06:49 +00:00
private log;
2022-12-19 13:44:54 +00:00
constructor(swarm: any, { id, logger, heartBeatInterval, ...opts }?: {
2022-11-24 01:39:45 +00:00
id?: Buffer;
2022-12-19 13:44:54 +00:00
logger?: Logger;
2022-11-24 01:39:45 +00:00
[key: string]: any;
});
private _cache;
2022-11-24 02:23:47 +00:00
get cache(): string[];
get allCache(): string[];
2022-11-24 06:50:30 +00:00
peerHasItem(peer: string | Buffer, item: string | Buffer): boolean;
2022-11-24 01:39:45 +00:00
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;
2022-12-05 11:59:58 +00:00
send(peer: any, message: any): void;
2022-11-24 01:39:45 +00:00
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;
2022-12-05 11:59:58 +00:00
private _heartbeatCheck;
private _emitHeartbeat;
2022-12-17 15:17:02 +00:00
private _hello;
2022-12-17 16:03:47 +00:00
private _sendItemsToPeer;
private _createAddItemRequestMessage;
private _createAddItemRequest;
2022-11-24 01:39:45 +00:00
}
//# sourceMappingURL=index.d.ts.map