NodeAddress
Este conteúdo não está disponível em sua língua ainda.
Defined in: src/cluster/NodeAddress.ts:5
A node in the cluster is identified by host + port + system name.
Stringified as system@host:port.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new NodeAddress(
systemName,host,port):NodeAddress
Defined in: src/cluster/NodeAddress.ts:6
Parameters
Section titled “Parameters”systemName
Section titled “systemName”string
string
number
Returns
Section titled “Returns”NodeAddress
Properties
Section titled “Properties”
readonlyhost:string
Defined in: src/cluster/NodeAddress.ts:8
readonlyport:number
Defined in: src/cluster/NodeAddress.ts:9
systemName
Section titled “systemName”
readonlysystemName:string
Defined in: src/cluster/NodeAddress.ts:7
Methods
Section titled “Methods”compareTo()
Section titled “compareTo()”compareTo(
other):number
Defined in: src/cluster/NodeAddress.ts:21
Ordering used by the leader election: lexicographic on the string form.
Parameters
Section titled “Parameters”NodeAddress
Returns
Section titled “Returns”number
equals()
Section titled “equals()”equals(
other):boolean
Defined in: src/cluster/NodeAddress.ts:14
Parameters
Section titled “Parameters”NodeAddress
Returns
Section titled “Returns”boolean
toJSON()
Section titled “toJSON()”toJSON():
NodeAddressData
Defined in: src/cluster/NodeAddress.ts:25
Returns
Section titled “Returns”toString()
Section titled “toString()”toString():
string
Defined in: src/cluster/NodeAddress.ts:12
Returns
Section titled “Returns”string
fromJSON()
Section titled “fromJSON()”
staticfromJSON(data):NodeAddress
Defined in: src/cluster/NodeAddress.ts:50
Rebuild an address from its wire form.
The declared parameter type is a promise the wire cannot keep: every caller
on the receive path hands this whatever JSON.parse produced. A port that
arrives as the string "2552" is the sharp case — toString() renders
it identically to the number, so it keys every map the same way, but
equals() compares === and never matches. A node that reads its own
address back in that shape stops recognising itself, permanently (#571).
Throwing rather than coercing is deliberate: a well-behaved peer never sends this, so there is no shape worth repairing, and the transport’s frame guard rejects malformed addresses before they get here. This is the backstop for the paths that reach it another way.
port is checked as a positive integer, not a TCP port — the same rule
ClusterOptionsValidator states and for the same reason: under
InMemoryTransport the port is a synthetic node discriminator (tests use
five-digit values), and an address is transport-agnostic. Whether a port
is dialable is TcpTransport’s business.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”NodeAddress
parse()
Section titled “parse()”
staticparse(s):NodeAddress
Defined in: src/cluster/NodeAddress.ts:64
Parse a string of the form system@host:port.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”NodeAddress
