API Documentation: Class NetworkProfile
| Name | NetworkProfile |
| Package | com.mckoi.network |
This class enables the discovery of machine roles in a network. It is intended to be used for administration functions only. It performs tasks such as querying machine details about nodes on the network, discovering nodes that aren't working, etc.
Constructors Summary
| NetworkProfile(NetworkConnector connector, String network_password) |
Methods Summary
Constructor Details
NetworkProfile(NetworkConnector connector, String network_password)
Constructs this profile object with the given NetworkConnector and network password.
Method Details
void setNetworkConfiguration(NetworkConfigResource config)
Sets the network configuration resource object used to query information about the network schema (the machines on the network).
boolean isValidMckoiNode(ServiceAddress machine)
Queries the machine at the given ServiceAddress and returns true if the machine is a valid Mckoi machine node.
ArrayList<ServiceAddress> sortedServerList()
Returns a machine list of all nodes in the network sorted by the ip/port address.
void refresh()
Refreshes this profile by inspecting the network and discovering any changes to state.
void refreshNetworkConfig()
Refresh the network configuration resource.
boolean isMachineInNetwork(ServiceAddress machine_addr)
Returns true if the given ServiceAddress is a machine node that is part of the network.
MachineProfile getMachineProfile(ServiceAddress address)
Returns a MachineProfile object of the machine in the network with the given ServiceAddress, or null if there is no machine in the schema with the given address.
MachineProfile getManagerServer()
Returns the current manager server of the network, from the profile, or null if there's current no manager assigned.
MachineProfile[] getRootServers()
Returns the set of all root servers in the network, from the profile, or an empty array if no root servers discovered.
MachineProfile[] getBlockServers()
Returns the set of all block servers in the network, from the profile, or an empty array if no block servers discovered.
MachineProfile[] getAllMachineProfiles()
Returns a list of all machine profiles discovered on the network.
void startManager(ServiceAddress machine)
Assign a machine to a manager server role. Generates an exception if there is already a manager server.
Note that this does not update service registration of nodes in the network.
void stopManager(ServiceAddress machine)
Relieve a machine from the manager server role. Generates an exception if the machine is not assigned as manager server.
Note that this does not update service registration of nodes in the network.
void startRoot(ServiceAddress machine)
Assign a machine to a root server role. Generates an exception if the machine is already assigned to be a root.
Note that this does not update service registration of nodes in the network.
void stopRoot(ServiceAddress machine)
Relieve a machine from a root server role. Generates an exception if the machine is not assigned as a root server.
Note that this does not update service registration of nodes in the network.
void startBlock(ServiceAddress machine)
Assign a machine to a block server role. Generates an exception if the machine is already assigned to be a block server.
Note that this does not update service registration of nodes in the network.
void stopBlock(ServiceAddress machine)
Relieve a machine from a block server role. Generates an exception if the machine is not assigned as a block server.
Note that this does not update service registration of nodes in the network.
void registerRoot(ServiceAddress root)
Contacts a root server and registers it to the current manager server assigned on the network.
void deregisterRoot(ServiceAddress root)
Contacts a root server and deregisters it from the current manager server assigned on the network.
void registerBlock(ServiceAddress block)
Contacts the current manager server assigned on the network and registers a block server to it.
void deregisterBlock(ServiceAddress block)
Contacts the current manager server assigned on the network and deregisters the given block server from it.
PathProfile[] getPathsFromRoot(ServiceAddress root)
Returns the list of paths and their consensus processors from the given root server.
PathProfile[] getAllPaths()
Returns the list of all paths from all root servers registered on the network (ordered in no significant way).
void addConsensusFunction(ServiceAddress root, String path_name, String consensus_fun)
Adds a new consensus and path to the given machine running a root service. In addition, this will tell the manager server about the path_name to root server association added.
void removeConsensusFunction(ServiceAddress root, String path_name)
Deletes a path name assigned on the given root server.
ServiceAddress getRootFor(String path_name)
Given a path name, queries the manager server and returns the root server that has been assigned to manage this path, or null if no root server association found.
String getPathStats(ServiceAddress root, String path_name)
Returns the stats string for the given path name on the given root server.
long getBlockGUID(ServiceAddress block)
Returns the GUID of a block server.
long getBlockMappingCount()
Return the number of block to block server mappings the manager server is currently managing.
long[] getBlockMappingRange(long p1, long p2)
Return a range of block to block server mappings between index p1 and p2 in the list. The returned array is arranged as block_id->server guid pairs.
Map<ServiceAddress, String> getBlocksStatus()
Returns the status and address of all registered block servers from the manager. The returned map is the ServiceAddress of a block server associated with its status string. The status being a static from DefaultManagerServer (eg. DefaultManagerServer.STATUS_UP).
long[] getAnalyticsStats(ServiceAddress server)
Returns the analytics history stats for the given server on the network. Note that the stats object could be large (a days worth of analytics at 1 min timeframe is about 64kb of data).
void processSendBlock(long block_id, ServiceAddress source_block_server, ServiceAddress dest_block_server, long dest_server_sguid)
Issues a command to the given block server to send the given block_id to the destination block server.
NetworkProfile tcpConnect(String network_password)
Creates a NetworkProfile in which requests are connected via a TCP connection for the service.
