public class StorageSystem extends Object
The StorageSystem is responsible for keeping track of all of the nodes in the cluster. Nodes can be added, removed, located, and relocated through the StorageSystem. Each Beehive server maintains a StorageSystem. Each StorageSystem only stores the nodes local to that server. If a server requires a remote node, the StorageSystem can fetch it as it caches the location of each node in the entire system.
The StorageSystem can also update and fetch properties of a node as opposed to the entire node itself; this is
achieved using NodeData. Bulk processing and parallel processing are also supported.
| Modifier and Type | Field and Description |
|---|---|
ConcurrentHashMap<String,String> |
locationTable |
HashtableServer |
myHashTableServer |
int |
myId |
String |
myURL |
static HashMap<Byte,Class> |
nodeClassMap |
static HashMap<Byte,String> |
nodeClassNameMap |
static HashMap<String,Byte> |
nodeClassNametoIDMap |
int |
numServers |
int[] |
partitionedGraphHostNodesTable |
boolean |
recordStats |
Vector<String> |
relocating |
static String |
RPC_MECHANISM |
ConcurrentHashMap<Integer,String> |
serverLocationMapping |
ConcurrentHashMap<String,Integer> |
serverMapping |
ConcurrentHashMap<Integer,HashtableServer> |
servers |
ConcurrentHashMap<Integer,HashTableThriftHandler> |
serversThrift |
boolean |
startCompute |
boolean |
writeThroughCache |
| Constructor and Description |
|---|
StorageSystem(Vector<String> hostList,
Config configParams)
Constructor without reference to local hashtable server object, backwards compatible
|
StorageSystem(Vector<String> hostList,
HashtableServer paramHashtableServer,
boolean writeThrough,
Config configParams,
HashMap<Byte,String> nodeClassNameMap,
HashMap<Byte,Class> nodeClassMap)
Identical to that of
StorageSystem(Vector, HashtableServer, Config, HashMap, HashMap) but with the option
to enable caching. |
StorageSystem(Vector<String> hostList,
HashtableServer paramHashtableServer,
Config configParams,
HashMap<Byte,String> nodeClassNameMap,
HashMap<Byte,Class> nodeClassMap)
Constructor with reference to local hashtable server object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearStatContainers()
Clears all of the statistics associated with the current StorageSystem
|
void |
enableStats()
Turns on stat recording
|
NodeData |
exec(NodeData n)
Remotely executes the methods of a node.
|
Vector<NodeData> |
execParallel(Vector<NodeData> paramVector)
Remotely executes the methods of several nodes in parallel.
|
Vector<String> |
getAllKeys(String url)
Gets all of the keys from a particular server
|
Vector<Node> |
getAllNodes() |
ClusterMeasures |
getClusterMeasures(String url) |
Vector<Node> |
getLocalNodes(Vector<String> nodeIds)
Gets all of the local nodes whose ids are passed in.
|
Vector<Node> |
getLocalNodes(Vector<String> nodeIds,
boolean withCaching)
Gets all of the local nodes whose ids are passed in.
|
Vector<NodeData> |
getLocalNodesData(Vector<NodeData> nodeData,
Vector<NodeData> remoteVector)
Gets specific properties of local nodes.
|
String |
getLocation(String nodeId) |
String |
getLocationURL(String nodeId)
Determines the url of the server storing the the node whose nodeId is given.
|
Node |
getNode(String nodeId) |
Node |
getNode(String nodeId,
boolean withCaching)
If
withCaching is true and |
NodeData |
getNodeProperties(NodeData n)
Gets specific properties of a node
|
Vector<NodeData> |
getNodePropertiesParallel(Vector<NodeData> nodeDatas)
Gets the desired properties of several nodes in parallel.
|
Vector<Node> |
getNodesParallel(Vector<String> nodeIds)
Gets several Nodes whose ids are passed in; does so in a parallel fashion.
|
Vector<Node> |
getNodesParallel(Vector<String> nodeIds,
boolean withCaching)
If
withCaching is true and |
int |
getNumberOfServers() |
HashtableServer |
getServer(String nodeId) |
int |
getServerID(String nodeId)
Gets the id of the server storing the node.
|
HashtableServer |
getServerThrift(String nodeId) |
String |
getStats() |
String |
getStats(boolean includeHashtable) |
void |
putNode(String nodeId,
Node node)
Puts a node into the local server or a remote server based on the
nodeId |
void |
putNodesParallel(Vector<Node> nodeList)
Puts several nodes into the local server or a remote server in parallel based on their respective nodeIds
|
boolean |
relocate(String nodeId)
Deprecated.
DO NOT USE
Relocates a remote node to the calling server. If the node is already local, then nothing happens. |
boolean |
relocate(String nodeId,
boolean lock)
Deprecated.
DO NOT USE
|
void |
updateNodeProperties(NodeData n)
Remotely updates the properties of a node whose nodeId is stored in
n. |
void |
updateNodePropertiesParallel(Vector<NodeData> nodeList)
Updates the properties of several nodes in parallel.
|
public ConcurrentHashMap<Integer,HashtableServer> servers
public ConcurrentHashMap<String,Integer> serverMapping
public ConcurrentHashMap<String,String> locationTable
public ConcurrentHashMap<Integer,String> serverLocationMapping
public String myURL
public int myId
public HashtableServer myHashTableServer
public int numServers
public boolean recordStats
public boolean writeThroughCache
public boolean startCompute
public int[] partitionedGraphHostNodesTable
public ConcurrentHashMap<Integer,HashTableThriftHandler> serversThrift
public static String RPC_MECHANISM
public StorageSystem(Vector<String> hostList, Config configParams) throws RemoteException
hostList - The names of all of the serversconfigParams - The configuration of this particular StorageSystemRemoteException - Thrown if the StorageSystem could not be startedpublic StorageSystem(Vector<String> hostList, HashtableServer paramHashtableServer, Config configParams, HashMap<Byte,String> nodeClassNameMap, HashMap<Byte,Class> nodeClassMap) throws RemoteException
hostList - The names of all of the serversparamHashtableServer - A handle to the hashtable server this system will call its ownconfigParams - The configuration of this particular StorageSystemnodeClassNameMap - Map containing Classnames of all the Node Inherited classes used in the programnodeClassMap - Map containing Classes of all the Node Inherited classes used in the programRemoteException - Thrown if the StorageSystem could not be startedpublic StorageSystem(Vector<String> hostList, HashtableServer paramHashtableServer, boolean writeThrough, Config configParams, HashMap<Byte,String> nodeClassNameMap, HashMap<Byte,Class> nodeClassMap) throws RemoteException
StorageSystem(Vector, HashtableServer, Config, HashMap, HashMap) but with the option
to enable caching.public int getNumberOfServers()
public void enableStats()
public Node getNode(String nodeId) throws RemoteException
nodeId - The id of the node that we want to fetch. Can be a local or remote id.RemoteException - Thrown if the node could not be fetched.public Node getNode(String nodeId, boolean withCaching) throws RemoteException
withCaching is true and getNode(String)nodeId - The id of the node that we want to fetch. Can be a local or remote id.withCaching - True if an attempt to fetch from cache is desired, false otherwise.RemoteException - Thrown if the node could not be fetched.public Vector<Node> getNodesParallel(Vector<String> nodeIds) throws RemoteException
nodeIds - The ids of the desired nodes. The ids can be a mixture of local and remote ids.RemoteException - Thrown if public Vector<Node> getNodesParallel(Vector<String> nodeIds, boolean withCaching) throws RemoteException
withCaching is true and getNodesParallel(Vector)nodeIds - The ids of the nodes we want to fetch. Can be a mixture of local and remote ids.withCaching - True if an attempt to fetch from cache is desired, false otherwise.RemoteException - Thrown only if caching is desired and the nodes could not be fetched from cache.public NodeData getNodeProperties(NodeData n) throws RemoteException, InterruptedException
n - A NodeData object containing:
RemoteException - Thrown if the properties could not be fetchedInterruptedException - Thrown if the properties could not be fetchedpublic Vector<NodeData> getNodePropertiesParallel(Vector<NodeData> nodeDatas) throws RemoteException, InterruptedException
nodeDatas - Each NodeData object will contain
RemoteException - Thrown if a node's properties could not be fetched.InterruptedException - Thrown if a node's properties could not be fetched.public NodeData exec(NodeData n) throws RemoteException
n - Contains the nodeId of the node whose methods are to be executed. The methods that are to be
executed are provided as a mapping of method name to parameters.RemoteExceptionpublic Vector<NodeData> execParallel(Vector<NodeData> paramVector) throws RemoteException
paramVector - A vector of NodeData object containing the nodeIds of nodes whose methods are to be
executedRemoteExceptionpublic void putNode(String nodeId, Node node) throws RemoteException
nodeIdnodeId - The identification of the node that is to be put into the servernode - The node that is to be put into the serverRemoteException - Thrown if the node could not be put into the serverpublic void putNodesParallel(Vector<Node> nodeList) throws RemoteException
nodeList - The nodes that are to be put into the servers.RemoteException - Thrown if a node could not be put into its serverpublic void updateNodeProperties(NodeData n) throws RemoteException, org.apache.thrift.TException
n.n - A NodeData containing the following:
RemoteException - Thrown if the update was unsuccessful and if the server is using RMIorg.apache.thrift.TException - Thrown if the update was unsuccessful and if the server is using Thriftpublic void updateNodePropertiesParallel(Vector<NodeData> nodeList) throws RemoteException
nodeList - A vector of NodeData that contain the following:
RemoteException - Thrown if the update was unsuccessful and if the server is using RMIpublic Vector<String> getAllKeys(String url) throws RemoteException
url - The url of the server whose keys we want to fetch.RemoteException - Thrown if the keys could not be fetched from the provided server url.public ClusterMeasures getClusterMeasures(String url) throws RemoteException
url - The url of the server whose ClusterMeasures we want to obtainClusterMeasures of the server at the provided urlRemoteException - Thrown if the server could not be contactedpublic boolean relocate(String nodeId) throws RemoteException
Relocates a remote node to the calling server. If the node is already local, then nothing happens.
nodeId - The id of the node that we want to relocateRemoteException - Thrown if the node could not be located.public boolean relocate(String nodeId, boolean lock) throws RemoteException
RemoteExceptionpublic String getLocationURL(String nodeId)
nodeId - The nodeId of the node whose location we want to determinepublic String getStats()
public String getStats(boolean includeHashtable) throws RemoteException
includeHashTable is true, then
the statistics for the corresponding HashtableServer is also included, otherwise it is not.RemoteException - Thrown if the hashtable server could not be contacted.public int getServerID(String nodeId)
nodeId - The id of the nodepublic HashtableServer getServer(String nodeId)
nodeId - The id of the nodepublic HashtableServer getServerThrift(String nodeId)
getServer(String)public Vector<Node> getLocalNodes(Vector<String> nodeIds)
nodeIds - The nodeIds of the local nodes we want to fetch.public Vector<NodeData> getLocalNodesData(Vector<NodeData> nodeData, Vector<NodeData> remoteVector)
nodeData - Each NodeData contains the nodeId of the node whose properties we want to fetch. The
desired properties are contained within the same NodeData object.remoteVector - A pointer to a vector of NodeData. Any remote nodeId from nodeData will be added
to this.nodeData and the respective
properties and values we wanted to fetch.public Vector<Node> getLocalNodes(Vector<String> nodeIds, boolean withCaching) throws RemoteException
withCaching is true and getLocalNodes(Vector)nodeIds - The nodeIds of the local nodes we want to fetch.withCaching - True if an attempt to include locally cached nodes is desired, false otherwise.RemoteException - Thrown if the cached nodes could not be fetched.public Vector<Node> getAllNodes() throws RemoteException
RemoteException - Thrown if all of the local nodes could not be fetched.public void clearStatContainers()
throws RemoteException
RemoteException - Thrown if the hashtable server could not be contacted