10+ other DiscoveryOptions

This commit is contained in:
makepost
2017-06-27 03:37:02 +03:00
parent d679494ef1
commit a960214b1e
2 changed files with 97 additions and 0 deletions

View File

@@ -275,4 +275,32 @@ class InitialObservations {
// broadcasts: ['qux']
// })
}
discovery() {
new cote.Responder({ name: 'LocalUnlessForwarded' }, { address: '127.0.0.1' });
new cote.Publisher({ name: 'PassionateGreeter' }, { helloInterval: 100 });
new cote.Requester({ name: 'Optimist' }, {
checkInterval: 1e5,
nodeTimeout: 1e6
});
new cote.Subscriber({ name: 'Hachiko' }, { masterTimeout: 9 * 365 * 24 * 60 * 60 * 1000 });
new cote.Monitor({ name: 'HelloService', port: 2345 }, {
monitor: false,
statusLogsEnabled: false
});
new cote.Monitor({ name: 'OfflineLogger', port: 2346 }, {
disableScreen: true,
helloLogsEnabled: false,
log: true
});
new cote.Responder({ name: 'HearsNoneAbove' }, { ignoreProcess: true });
new cote.Requester({ name: 'OwnStatusReporter' }, { statusInterval: 100 });
}
}

69
types/cote/index.d.ts vendored
View File

@@ -238,6 +238,75 @@ export interface Advertisement {
* Controls the network-layer configuration and environments for components.
*/
export interface DiscoveryOptions {
/**
* Multicast address if using multicast.
*/
multicast?: string;
/**
* Broadcast address if using broadcast.
*/
broadcast?: string;
/**
* Address to bind to.
*/
address?: string;
/**
* How often to broadcast a hello packet in milliseconds.
*/
helloInterval?: number;
/**
* How often to to check for missing nodes in milliseconds.
*/
checkInterval?: number;
/**
* Consider a node dead if not seen in this many milliseconds.
*/
nodeTimeout?: number;
/**
* Consider a master node dead if not seen in this many milliseconds.
*/
masterTimeout?: number;
/**
* Skips key equality checks when logging.
*/
monitor?: boolean;
/**
* If false, disables `helloLogsEnabled` and `statusLogsEnabled` no matter
* what value they have, and also own hello log.
*/
log?: boolean;
/**
* Notifies when another service goes online.
*/
helloLogsEnabled?: boolean;
/**
* Notifies when another service goes online or offline. If false, disables
* `helloLogsEnabled` as well.
*/
statusLogsEnabled?: boolean;
/**
* Ignores messages from other services within the same process.
*/
ignoreProcess?: boolean;
/**
* Prevents Monitor from drawing.
*/
disableScreen?: boolean;
/**
* Milliseconds between emissions of own status for monitoring.
*/
statusInterval?: number;
}