diff --git a/packages/core/src/Network.ts b/packages/core/src/Network.ts index 677cb48..ac44593 100644 --- a/packages/core/src/Network.ts +++ b/packages/core/src/Network.ts @@ -241,11 +241,7 @@ export class Network { this.#exchanges = new Exchanges(this); // Setup the topology of the network - this.#topology = new Topology({ - networkIdBinary: this.networkIdBinary, - networkId: this.networkId, - debugNamespace: debugNamespace - }, options); + this.#topology = new Topology(this, options); this.#topology.onAvailable(n => { const node = new NetworkNode(debugNamespace, this.#topology, n.id); diff --git a/packages/core/src/WithNetwork.ts b/packages/core/src/WithNetwork.ts deleted file mode 100644 index d523766..0000000 --- a/packages/core/src/WithNetwork.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Interface used for things that are tied to a network, such as transports. - */ -export interface WithNetwork { - /** - * The identifier of the current node within the network. - */ - readonly networkIdBinary: ArrayBuffer; - - /** - * Identifier of this node as a string. - */ - readonly networkId: string; - - /** - * The debug namespace. - */ - readonly debugNamespace: string; -} diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 1d97b12..09b9908 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -61,7 +61,5 @@ export * from './MessageData'; export * from './MessageType'; export * from './MessageUnion'; -export * from './WithNetwork'; - export * from './exchange/Exchange'; export * from './RequestReplyHelper'; diff --git a/packages/core/src/topology/Topology.ts b/packages/core/src/topology/Topology.ts index fc0c8cc..116981f 100644 --- a/packages/core/src/topology/Topology.ts +++ b/packages/core/src/topology/Topology.ts @@ -14,7 +14,7 @@ import { } from 'ataraxia-transport'; import { IdMap, IdSet } from '../id'; -import { WithNetwork } from '../WithNetwork'; +import { Network } from '../Network'; import { Messaging } from './Messaging'; import { Routing } from './Routing'; @@ -60,7 +60,7 @@ export interface TopologyOptions { */ // TODO: Gossip about updated peer latencies export class Topology { - private readonly parent: WithNetwork; + private readonly parent: Network; private readonly debug: debug.Debugger; private readonly endpoint: boolean; @@ -91,7 +91,7 @@ export class Topology { * @param options - * options to apply */ - public constructor(parent: WithNetwork, options: TopologyOptions) { + public constructor(parent: Network, options: TopologyOptions) { this.parent = parent; this.endpoint = options.endpoint || false; this.broadcastTimeout = null; @@ -103,7 +103,7 @@ export class Topology { this.unavailableEvent = new Event(this); this.dataEvent = new Event(this); - this.debug = debug(parent.debugNamespace + ':topology'); + this.debug = debug('ataraxia:' + parent.networkName + ':topology'); this.self = new TopologyNode(this, parent.networkIdBinary); this.self.direct = true;