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

Method constructor

lib/host.js:40–133  ·  view source on GitHub ↗

* Creates a new Host instance.

(address, protocolVersion, options, metadata)

Source from the content-addressed store, hash-verified

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;
93
94 /**
95 * Gets the id of the host.
96 * <p>This identifier is used by the server for internal communication / gossip.</p>
97 * @type {Uuid}

Callers

nothing calls this directly

Calls 3

_onNewConnectionOpenMethod · 0.95
_checkPoolStateMethod · 0.95
newScheduleMethod · 0.80

Tested by

no test coverage detected