public class DiscoveryNodes extends AbstractDiffable<DiscoveryNodes> implements java.lang.Iterable<DiscoveryNode>
DiscoveryNode
in the cluster and provides convenience methods to
access, modify merge / diff discovery nodes.Modifier and Type | Class and Description |
---|---|
static class |
DiscoveryNodes.Builder |
static class |
DiscoveryNodes.Delta |
Writeable.Reader<V>, Writeable.Writer<V>
Modifier and Type | Field and Description |
---|---|
static DiscoveryNodes |
EMPTY_NODES |
Modifier and Type | Method and Description |
---|---|
static DiscoveryNodes.Builder |
builder() |
static DiscoveryNodes.Builder |
builder(DiscoveryNodes nodes) |
DiscoveryNodes.Delta |
delta(DiscoveryNodes other)
Returns the changes comparing this nodes to the provided nodes.
|
DiscoveryNode |
findByAddress(TransportAddress address)
Get a node by its address
|
DiscoveryNode |
get(java.lang.String nodeId)
Get a node by its id
|
ImmutableOpenMap<java.lang.String,DiscoveryNode> |
getDataNodes()
Get a
Map of the discovered data nodes arranged by their ids |
ImmutableOpenMap<java.lang.String,DiscoveryNode> |
getIngestNodes() |
Version |
getLargestNonClientNodeVersion()
Returns the version of the node with the youngest version in the cluster that is not a client node.
|
DiscoveryNode |
getLocalNode()
Get the local node
|
java.lang.String |
getLocalNodeId()
Get the id of the local node
|
ImmutableOpenMap<java.lang.String,DiscoveryNode> |
getMasterAndDataNodes()
Get a
Map of the discovered master and data nodes arranged by their ids |
DiscoveryNode |
getMasterNode()
Get the master node
|
java.lang.String |
getMasterNodeId()
Get the id of the master node
|
ImmutableOpenMap<java.lang.String,DiscoveryNode> |
getMasterNodes()
Get a
Map of the discovered master nodes arranged by their ids |
Version |
getMaxNodeVersion()
Returns the version of the node with the yougest version in the cluster
|
Version |
getMinNodeVersion()
Returns the version of the node with the oldest version in the cluster.
|
ImmutableOpenMap<java.lang.String,DiscoveryNode> |
getNodes()
Get a
Map of the discovered nodes arranged by their ids |
int |
getSize()
Get the number of known nodes
|
Version |
getSmallestNonClientNodeVersion()
Returns the version of the node with the oldest version in the cluster that is not a client node
If there are no non-client nodes, Version.CURRENT will be returned.
|
boolean |
isAllNodes(java.lang.String... nodesIds) |
boolean |
isLocalNodeElectedMaster()
Returns true if the local node is the elected master node.
|
java.util.Iterator<DiscoveryNode> |
iterator() |
DiscoveryNodes |
newNode(DiscoveryNode node) |
boolean |
nodeExists(DiscoveryNode node)
Determine if a given node exists
|
boolean |
nodeExists(java.lang.String nodeId)
Determine if a given node id exists
|
static Diff<DiscoveryNodes> |
readDiffFrom(StreamInput in,
DiscoveryNode localNode) |
static DiscoveryNodes |
readFrom(StreamInput in,
DiscoveryNode localNode) |
DiscoveryNodes |
removeDeadMembers(java.util.Set<java.lang.String> newNodes,
java.lang.String masterNodeId) |
DiscoveryNode |
resolveNode(java.lang.String node)
Resolve a node with a given id
|
java.lang.String[] |
resolveNodes(java.lang.String... nodes)
resolves a set of node "descriptions" to concrete and existing node ids.
|
java.lang.String |
toString() |
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
diff, get, readDiffFrom
public static final DiscoveryNodes EMPTY_NODES
public java.util.Iterator<DiscoveryNode> iterator()
iterator
in interface java.lang.Iterable<DiscoveryNode>
public boolean isLocalNodeElectedMaster()
public int getSize()
public ImmutableOpenMap<java.lang.String,DiscoveryNode> getNodes()
Map
of the discovered nodes arranged by their idsMap
of the discovered nodes arranged by their idspublic ImmutableOpenMap<java.lang.String,DiscoveryNode> getDataNodes()
Map
of the discovered data nodes arranged by their idsMap
of the discovered data nodes arranged by their idspublic ImmutableOpenMap<java.lang.String,DiscoveryNode> getMasterNodes()
Map
of the discovered master nodes arranged by their idsMap
of the discovered master nodes arranged by their idspublic ImmutableOpenMap<java.lang.String,DiscoveryNode> getIngestNodes()
public ImmutableOpenMap<java.lang.String,DiscoveryNode> getMasterAndDataNodes()
Map
of the discovered master and data nodes arranged by their idsMap
of the discovered master and data nodes arranged by their idspublic DiscoveryNode get(java.lang.String nodeId)
nodeId
- id of the wanted nodenull
public boolean nodeExists(java.lang.String nodeId)
nodeId
- id of the node which existence should be verifiedtrue
if the node exists. Otherwise false
public boolean nodeExists(DiscoveryNode node)
node
- of the node which existence should be verifiedtrue
if the node exists. Otherwise false
public java.lang.String getMasterNodeId()
public java.lang.String getLocalNodeId()
public DiscoveryNode getLocalNode()
public DiscoveryNode getMasterNode()
public DiscoveryNode findByAddress(TransportAddress address)
address
- TransportAddress
of the wanted nodenull
if no such node existspublic boolean isAllNodes(java.lang.String... nodesIds)
public Version getSmallestNonClientNodeVersion()
public Version getLargestNonClientNodeVersion()
public Version getMinNodeVersion()
public Version getMaxNodeVersion()
public DiscoveryNode resolveNode(java.lang.String node)
node
- id of the node to discoverjava.lang.IllegalArgumentException
- if more than one node matches the request or no nodes have been resolvedpublic java.lang.String[] resolveNodes(java.lang.String... nodes)
public DiscoveryNodes removeDeadMembers(java.util.Set<java.lang.String> newNodes, java.lang.String masterNodeId)
public DiscoveryNodes newNode(DiscoveryNode node)
public DiscoveryNodes.Delta delta(DiscoveryNodes other)
public java.lang.String toString()
toString
in class java.lang.Object
public void writeTo(StreamOutput out) throws java.io.IOException
Writeable
public static DiscoveryNodes readFrom(StreamInput in, DiscoveryNode localNode) throws java.io.IOException
java.io.IOException
public static Diff<DiscoveryNodes> readDiffFrom(StreamInput in, DiscoveryNode localNode) throws java.io.IOException
java.io.IOException
public static DiscoveryNodes.Builder builder()
public static DiscoveryNodes.Builder builder(DiscoveryNodes nodes)