public class MeshOrganizer extends Object implements Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
MeshOrganizer.Node
This class represents basic tree node
|
| Modifier and Type | Field and Description |
|---|---|
protected Queue<MeshOrganizer.Node> |
fillQueue |
static int |
MAX_DEPTH |
static int |
MAX_DOWNSTREAMS |
| Constructor and Description |
|---|
MeshOrganizer() |
MeshOrganizer(@NonNull MeshBuildMode mode)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
MeshOrganizer.Node |
addNode(@NonNull MeshOrganizer.Node node)
This method adds new node to the mesh
|
MeshOrganizer.Node |
addNode(@NonNull String ip)
This method adds new node to the network
PLEASE NOTE: Default port 40123 is used
|
MeshOrganizer.Node |
addNode(@NonNull String ip,
@NonNull int port)
This methods adds new node to the network
|
MeshOrganizer |
clone()
This method returns absolutely independent copy of this Mesh
|
boolean |
equals(Object o) |
Collection<MeshOrganizer.Node> |
flatNodes()
This method returns our mesh as collection of nodes
|
protected long |
flatSize()
This method returns size of flattened map of nodes.
|
Collection<MeshOrganizer.Node> |
getDownstreamsForNode(@NonNull String ip)
This method returns downstream connections for a given node
|
MeshOrganizer.Node |
getNodeById(@NonNull String id)
This method returns Node representing given IP
|
MeshOrganizer.Node |
getUpstreamForNode(@NonNull String ip)
This method returns upstream connection for a given node
|
long |
getVersion() |
int |
hashCode() |
boolean |
isKnownNode(@NonNull String id)
This method returns true, if node is known
|
void |
markNodeOffline(@NonNull MeshOrganizer.Node node)
This method marks given Node as offline, remapping its downstreams
|
void |
markNodeOffline(@NonNull String ip)
This method marks Node (specified by IP) as offline, and remaps its downstreams
|
long |
numberOfDescendantsOfNode()
This method returns total number of nodes below given one
|
void |
remapNode(@NonNull MeshOrganizer.Node node)
This method reconnects given node to another node
|
void |
remapNode(@NonNull String ip)
This method reconnects given node to another node
|
void |
remapNodeAndDownstreams(@NonNull MeshOrganizer.Node node)
This method remaps node and its downstreams somewhere
|
void |
remapNodeAndDownstreams(@NonNull String ip)
This method reconnects given node to another node
|
void |
removeNode()
This method removes node from tree
|
long |
totalNodes()
This method returns total number of nodes in this mesh
PLESE NOTE: this method INCLUDES root node
|
public static final int MAX_DOWNSTREAMS
public static final int MAX_DEPTH
protected transient Queue<MeshOrganizer.Node> fillQueue
public MeshOrganizer()
@Deprecated public MeshOrganizer(@NonNull @NonNull MeshBuildMode mode)
public long getVersion()
public MeshOrganizer.Node addNode(@NonNull @NonNull String ip)
ip - public MeshOrganizer.Node addNode(@NonNull @NonNull String ip, @NonNull @NonNull int port)
public MeshOrganizer clone()
public MeshOrganizer.Node addNode(@NonNull @NonNull MeshOrganizer.Node node)
node - public void markNodeOffline(@NonNull
@NonNull String ip)
throws NoSuchElementException
ip - NoSuchElementExceptionpublic void markNodeOffline(@NonNull
@NonNull MeshOrganizer.Node node)
node - public void remapNode(@NonNull
@NonNull String ip)
public void remapNodeAndDownstreams(@NonNull
@NonNull String ip)
public void remapNodeAndDownstreams(@NonNull
@NonNull MeshOrganizer.Node node)
node - public void remapNode(@NonNull
@NonNull MeshOrganizer.Node node)
public void removeNode()
public boolean isKnownNode(@NonNull
@NonNull String id)
public MeshOrganizer.Node getUpstreamForNode(@NonNull @NonNull String ip) throws NoSuchElementException
NoSuchElementExceptionpublic Collection<MeshOrganizer.Node> getDownstreamsForNode(@NonNull @NonNull String ip) throws NoSuchElementException
NoSuchElementExceptionpublic long numberOfDescendantsOfNode()
public long totalNodes()
protected long flatSize()
public Collection<MeshOrganizer.Node> flatNodes()
public MeshOrganizer.Node getNodeById(@NonNull @NonNull String id) throws NoSuchElementException
NoSuchElementExceptionCopyright © 2021. All rights reserved.