diff --git a/types/cote/cote-tests.ts b/types/cote/cote-tests.ts index 25a65555d2..6448111364 100644 --- a/types/cote/cote-tests.ts +++ b/types/cote/cote-tests.ts @@ -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 }); + } } diff --git a/types/cote/index.d.ts b/types/cote/index.d.ts index 7a59fea23c..074ba34ec0 100644 --- a/types/cote/index.d.ts +++ b/types/cote/index.d.ts @@ -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; }