Compare commits

...

3 Commits

Author SHA1 Message Date
Derrick Hammer 866c91c0c6
*Update dist 2022-11-16 10:48:41 -05:00
Derrick Hammer c534be442c
*Make setData public 2022-11-16 10:48:09 -05:00
Derrick Hammer a70b3154e0
*Remove stray methods 2022-11-16 10:47:40 -05:00
4 changed files with 3 additions and 21 deletions

View File

@ -15,19 +15,17 @@ export default class DHTOnlineBase extends EventEmitter {
get online(): string[]; get online(): string[];
broadcast(data: any, ttl?: number): void; broadcast(data: any, ttl?: number): void;
getPeerData(id: Buffer | string): any; getPeerData(id: Buffer | string): any;
protected setData(data: any): void; setData(data: any): void;
private _broadcastData; private _broadcastData;
protected onAddPeer(id: Buffer): void; protected onAddPeer(id: Buffer): void;
protected onRemovePeer(id: Buffer): void; protected onRemovePeer(id: Buffer): void;
protected onGetBroadcast(message: Buffer, id: Buffer): void; protected onGetBroadcast(message: Buffer, id: Buffer): void;
private _hasSeenPeer; private _hasSeenPeer;
private _setPeer; private _setPeer;
private _removePeer;
private _ensurePeer; private _ensurePeer;
private _addPeerConnection; private _addPeerConnection;
private _removePeerConnection; private _removePeerConnection;
private _bootstrapFrom; private _bootstrapFrom;
private _getPeerConnectedTo;
private _getBootstrapInfo; private _getBootstrapInfo;
private _recalculate; private _recalculate;
private _maybeHexify; private _maybeHexify;

View File

@ -1 +1 @@
{"version":3,"file":"dhtOnlineBase.d.ts","sourceRoot":"","sources":["../src/dhtOnlineBase.ts"],"names":[],"mappings":";;AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAYlC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,YAAY;IACrD,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,KAAK,CAAM;IACnB,OAAO,CAAC,WAAW,CAAW;IAC9B,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,QAAQ,CAAoB;gBAExB,EAAE,EAAE,MAAM,EAAE,EAAE,QAA2B,EAAE;;KAAK;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AS,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM;IAIjC,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAIxB,OAAO,CAAC,IAAI,EAAE,GAAG;IAQxB,OAAO,CAAC,cAAc;IAgBtB,SAAS,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM;IAqC9B,SAAS,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM;IAiBjC,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IA6CpD,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,QAAQ;IAGhB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,qBAAqB;IAa7B,OAAO,CAAC,cAAc;IA2BtB,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,YAAY;CAOrB"}

View File

@ -135,9 +135,6 @@ class DHTOnlineBase extends events_1.default {
_setPeer(id, data) { _setPeer(id, data) {
this.graph.addNode(this._maybeHexify(id), data); this.graph.addNode(this._maybeHexify(id), data);
} }
_removePeer(id) {
this.graph.removeNode(this._maybeHexify(id));
}
_ensurePeer(id) { _ensurePeer(id) {
id = this._maybeHexify(id); id = this._maybeHexify(id);
if (!this._hasSeenPeer(id)) { if (!this._hasSeenPeer(id)) {
@ -185,9 +182,6 @@ class DHTOnlineBase extends events_1.default {
this.emit("bootstrapped"); this.emit("bootstrapped");
this._recalculate(); this._recalculate();
} }
_getPeerConnectedTo(id) {
return this.graph.successors(id);
}
_getBootstrapInfo() { _getBootstrapInfo() {
const state = {}; const state = {};
for (const [id, rawData] of this.graph.nodes(true)) { for (const [id, rawData] of this.graph.nodes(true)) {

View File

@ -45,7 +45,7 @@ export default class DHTOnlineBase extends EventEmitter {
return this.graph.node.get(this._maybeHexify(id)); return this.graph.node.get(this._maybeHexify(id));
} }
protected setData(data: any) { public setData(data: any) {
this.data = data; this.data = data;
this._setPeer(this.id, data); this._setPeer(this.id, data);
@ -175,11 +175,6 @@ export default class DHTOnlineBase extends EventEmitter {
private _setPeer(id: Buffer | string, data: any) { private _setPeer(id: Buffer | string, data: any) {
this.graph.addNode(this._maybeHexify(id), data); this.graph.addNode(this._maybeHexify(id), data);
} }
private _removePeer(id: Buffer | string) {
this.graph.removeNode(this._maybeHexify(id));
}
private _ensurePeer(id: Buffer | string) { private _ensurePeer(id: Buffer | string) {
id = this._maybeHexify(id); id = this._maybeHexify(id);
if (!this._hasSeenPeer(id)) { if (!this._hasSeenPeer(id)) {
@ -239,11 +234,6 @@ export default class DHTOnlineBase extends EventEmitter {
this._recalculate(); this._recalculate();
} }
private _getPeerConnectedTo(id: string) {
return this.graph.successors(id);
}
private _getBootstrapInfo() { private _getBootstrapInfo() {
const state: Bootstrap = {}; const state: Bootstrap = {};
for (const [id, rawData] of this.graph.nodes(true)) { for (const [id, rawData] of this.graph.nodes(true)) {