RegisterSign In

API Documentation: Class 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

void setNetworkConfiguration(NetworkConfigResource config) throws IOException
static boolean isConnectionFailure(Message m)
boolean isValidMckoiNode(ServiceAddress machine)
ArrayList<ServiceAddress> sortedServerList()
void refresh()
void refreshNetworkConfig() throws IOException
boolean isMachineInNetwork(ServiceAddress machine_addr)
MachineProfile getMachineProfile(ServiceAddress address)
MachineProfile[] getManagerServers()
MachineProfile[] getRootServers()
MachineProfile[] getBlockServers()
MachineProfile[] getAllMachineProfiles()
void startManager(ServiceAddress machine) throws NetworkAdminException
void stopManager(ServiceAddress machine) throws NetworkAdminException
void startRoot(ServiceAddress machine) throws NetworkAdminException
void stopRoot(ServiceAddress machine) throws NetworkAdminException
void startBlock(ServiceAddress machine) throws NetworkAdminException
void stopBlock(ServiceAddress machine) throws NetworkAdminException
void registerManager(ServiceAddress manager) throws NetworkAdminException
void deregisterManager(ServiceAddress root) throws NetworkAdminException
void registerRoot(ServiceAddress root) throws NetworkAdminException
void deregisterRoot(ServiceAddress root) throws NetworkAdminException
void registerBlock(ServiceAddress block) throws NetworkAdminException
void deregisterBlock(ServiceAddress block) throws NetworkAdminException
String[] getAllPathNames() throws NetworkAdminException
PathInfo getPathInfoForPath(String path_name) throws NetworkAdminException
void addPathToNetwork(String path_name, String consensus_fun, ServiceAddress root_leader, ServiceAddress[] root_servers) throws NetworkAdminException
void removePathFromNetwork(String path_name, ServiceAddress root_server) throws NetworkAdminException
DataAddress[] getHistoricalPathRoots(ServiceAddress root, String path_name, long timestamp, int max_count) throws NetworkAdminException
void setPathRoot(ServiceAddress root, String path_name, DataAddress address) throws NetworkAdminException
String getPathStats(PathInfo path_info) throws NetworkAdminException
long getBlockGUID(ServiceAddress block) throws NetworkAdminException
long getBlockMappingCount() throws NetworkAdminException
long[] getBlockMappingRange(long p1, long p2) throws NetworkAdminException
Map<ServiceAddress, String> getBlocksStatus() throws NetworkAdminException
void addBlockAssociation(long block_id, long server_guid) throws NetworkAdminException
void removeBlockAssociation(long block_id, long server_guid) throws NetworkAdminException
long[] getBlockList(ServiceAddress block) throws NetworkAdminException
long[] getAnalyticsStats(ServiceAddress server) throws NetworkAdminException
void processSendBlock(long block_id, ServiceAddress source_block_server, ServiceAddress dest_block_server, long dest_server_sguid) throws NetworkAdminException
String getManagerDebugString(ServiceAddress manager_server) throws NetworkAdminException
static NetworkProfile tcpConnect(String network_password)

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).

static boolean isConnectionFailure(Message m)

Returns true if the error message is a connection failure message.

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[] getManagerServers()

Returns the current manager servers on 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 registerManager(ServiceAddress manager)

Registers a manager with the current managers assigned on the network.

void deregisterManager(ServiceAddress root)

Registers a manager with the current managers assigned on 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.

String[] getAllPathNames()

Returns the list of all path names from all root servers registered on the network (ordered in no significant way).

PathInfo getPathInfoForPath(String path_name)

Returns the PathInfo for the given path name, or null if the path is not defined.

void addPathToNetwork(String path_name, String consensus_fun, ServiceAddress root_leader, ServiceAddress[] root_servers)

Adds a path/root server map to the network. This sends the path map to the first available manager server.

void removePathFromNetwork(String path_name, ServiceAddress root_server)

Removes a path/root server map from the network. This sends the path map removal command from the first available manager server.

DataAddress[] getHistoricalPathRoots(ServiceAddress root, String path_name, long timestamp, int max_count)

Returns an array of DataAddress that represent the snapshots stored on the given path at the time of the given timestamp. This will always return DataAddress object regardless of whether any commits happened at the given time or not. The returned DataAddress objects will be snapshots at roughly the time given.

void setPathRoot(ServiceAddress root, String path_name, DataAddress address)

Sets the root for the given path name by issuing a 'publish' command on the root server. Great care should be taken when using this function because it bypasses all commit checks.

String getPathStats(PathInfo path_info)

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).

void addBlockAssociation(long block_id, long server_guid)

Contacts the current manager server and changes the database to make a block_id -> server_guid association for that block. After this call, the manager server will return the given server as a container for the given block_id.

void removeBlockAssociation(long block_id, long server_guid)

Contacts the current manager server and change the database to remove a block_id -> server_guid association. After this call, the manager server will no longer return the given server as a container for the given block_id.

long[] getBlockList(ServiceAddress block)

Returns the list of all blocks stored on a block server, reported by the block server.

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.

String getManagerDebugString(ServiceAddress manager_server)

Returns the debug string from the manager.

static NetworkProfile tcpConnect(String network_password)

Creates a NetworkProfile in which requests are connected via a TCP connection for the service.

The text on this page is licensed under the Creative Commons Attribution 3.0 License. Java is a registered trademark of Oracle and/or its affiliates.
Mckoi is Copyright © 2000 - 2020 Diehl and Associates, Inc. All rights reserved.