MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / Host

Class Host

lib/host.js:35–445  ·  view source on GitHub ↗

* Represents a Cassandra node. * @extends EventEmitter

Source from the content-addressed store, hash-verified

33 * @extends EventEmitter
34 */
35class Host extends events.EventEmitter {
36
37 /**
38 * Creates a new Host instance.
39 */
40 constructor(address, protocolVersion, options, metadata) {
41 super();
42 /**
43 * Gets ip address and port number of the node separated by `:`.
44 * @type {String}
45 */
46 this.address = address;
47 this.setDownAt = 0;
48 this.log = utils.log;
49
50 /**
51 * Gets the timestamp of the moment when the Host was marked as UP.
52 * @type {Number|null}
53 * @ignore
54 * @internal
55 */
56 this.isUpSince = null;
57 Object.defineProperty(this, 'options', { value: options, enumerable: false, writable: false });
58
59 /**
60 * The host pool.
61 * @internal
62 * @ignore
63 * @type {HostConnectionPool}
64 */
65 Object.defineProperty(this, 'pool', { value: new HostConnectionPool(this, protocolVersion), enumerable: false });
66
67 this.pool.on('open', err => promiseUtils.toBackground(this._onNewConnectionOpen(err)));
68 this.pool.on('remove', () => this._checkPoolState());
69
70 /**
71 * Gets string containing the Cassandra version.
72 * @type {String}
73 */
74 this.cassandraVersion = null;
75
76 /**
77 * Gets data center name of the node.
78 * @type {String}
79 */
80 this.datacenter = null;
81
82 /**
83 * Gets rack name of the node.
84 * @type {String}
85 */
86 this.rack = null;
87
88 /**
89 * Gets the tokens assigned to the node.
90 * @type {Array}
91 */
92 this.tokens = null;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected