Skip to content

Commit

Permalink
chore(core): Remove WithNetwork
Browse files Browse the repository at this point in the history
  • Loading branch information
aholstenson committed Jun 17, 2021
1 parent 766b9c0 commit 9adb458
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 30 deletions.
6 changes: 1 addition & 5 deletions packages/core/src/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,7 @@ export class Network<MessageTypes extends object = any> {
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);
Expand Down
19 changes: 0 additions & 19 deletions packages/core/src/WithNetwork.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,5 @@ export * from './MessageData';
export * from './MessageType';
export * from './MessageUnion';

export * from './WithNetwork';

export * from './exchange/Exchange';
export * from './RequestReplyHelper';
8 changes: 4 additions & 4 deletions packages/core/src/topology/Topology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 9adb458

Please sign in to comment.