Home Reference Source Repository
import Discovery from 'wyst/es6/Services/Advertiser.js'
public class | source

Discovery

Extends:

eventemitter2~EventEmitterExpressiveTable → Discovery

API that handles the lifecycle for updating and maintaing local copies of a Discovery

Static Member Summary

Static Public Members
public static get

normalizes the os.interfaces Object

Constructor Summary

Public Constructor
public

constructor(settings: Object)

initializes and resolves to an Advertiser instance

Member Summary

Public Members
public
public get

returns a snapshot of the current Instance

public get

file: String: *

returns the location where an Instance's id file should reside

Method Summary

Public Methods
public

main loop that generates heartbeats

public

Determines if it has id file.

public

heartbeat to let other Services know that this one is alive

public

kill()

kills the Advertiser instance and makes sure we don't spawn a ZOMBIEEEEE

public

generates the Instance context

public

fetches or creates a new ID for the Instance

public

saves the id to the local filesystem to survive Instance restarts

Inherited Summary

From class Expressive
public static

create(): *

creates a new inherited instance

public

debug: *

public

is(state: string): *

expressive emit

public

when(): *

expressive once

From class Table
public static get

table: Thinky:Table: *

returns a reference to the raw Table object

public static get

returns what the table name is, useful for raw r commands

public static

createModel(config: Array): *

creates a Thinky model

public static

drop(): *

drops this table on the database, primarily used to clean up after tests

public static

empty(): *

empties all rows from the table

public static

row(attrs: Object): *

creates a new row on this Table

public

table: *

Static Public Members

public static get interfaces: Array: * source

normalizes the os.interfaces Object

Return:

Array

os.interfaces() => Array

Public Constructors

public constructor(settings: Object) source

initializes and resolves to an Advertiser instance

Override:

Table#constructor

Params:

NameTypeAttributeDescription
settings Object

The settings

Public Members

public advertising: boolean source

public get attributes: Object: * source

returns a snapshot of the current Instance

Return:

Object

the snapshot to use in a heartbeat

public get file: String: * source

returns the location where an Instance's id file should reside

Properties:

NameTypeAttributeDescription
file *

Return:

String

Return Properties:

NameTypeAttributeDescription
file *

Public Methods

public advertise(): null source

main loop that generates heartbeats

Return:

null

public hasIdFile(): Promise source

Determines if it has id file.

Return:

Promise

resolves to True if has id file, False otherwise.

public heartbeat(): Promise source

heartbeat to let other Services know that this one is alive

Return:

Promise

public kill() source

kills the Advertiser instance and makes sure we don't spawn a ZOMBIEEEEE

public loadContext(): Promise source

generates the Instance context

Return:

Promise

public loadId(): Promise source

fetches or creates a new ID for the Instance

Return:

Promise

Resolve to the id

public saveId(id: String): Promise source

saves the id to the local filesystem to survive Instance restarts

Params:

NameTypeAttributeDescription
id String

the id to be persisted

Return:

Promise