|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.solr.common.cloud.ClusterState
public class ClusterState
Immutable state of the cloud. Normally you can get the state by using
ZkStateReader.getClusterState()
.
Constructor Summary | |
---|---|
ClusterState(Integer zkClusterStateVersion,
Set<String> liveNodes,
Map<String,Map<String,Slice>> collectionStates)
Use this constr when ClusterState is meant for consumption. |
|
ClusterState(Set<String> liveNodes,
Map<String,Map<String,Slice>> collectionStates)
Use this constr when ClusterState is meant for publication. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
Set<String> |
getCollections()
Get collection names. |
Map<String,Map<String,Slice>> |
getCollectionStates()
|
ZkNodeProps |
getLeader(String collection,
String shard)
Get properties of a shard leader for specific collection. |
Set<String> |
getLiveNodes()
Get names of the currently live nodes. |
org.apache.solr.common.cloud.ClusterState.RangeInfo |
getRanges(String collection)
|
String |
getShard(int hash,
String collection)
Get shard id for hash. |
String |
getShardId(String coreNodeName)
Get shardId for core. |
ZkNodeProps |
getShardProps(String collection,
String coreNodeName)
Get shard properties or null if shard is not found. |
Slice |
getSlice(String collection,
String slice)
Get the index Slice for collection. |
Map<String,Slice> |
getSlices(String collection)
Get all slices for collection. |
Integer |
getZkClusterStateVersion()
The version of clusterstate.json in ZooKeeper. |
int |
hashCode()
|
boolean |
liveNodesContain(String name)
Check if node is alive. |
static ClusterState |
load(Integer version,
byte[] bytes,
Set<String> liveNodes)
Create ClusterState from json string that is typically stored in zookeeper. |
static ClusterState |
load(SolrZkClient zkClient,
Set<String> liveNodes)
Create ClusterState by reading the current state from zookeeper. |
String |
toString()
|
void |
write(JSONWriter jsonWriter)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ClusterState(Set<String> liveNodes, Map<String,Map<String,Slice>> collectionStates)
liveNodes
- collectionStates
- public ClusterState(Integer zkClusterStateVersion, Set<String> liveNodes, Map<String,Map<String,Slice>> collectionStates)
zkClusterStateVersion
- liveNodes
- collectionStates
- Method Detail |
---|
public ZkNodeProps getLeader(String collection, String shard)
public ZkNodeProps getShardProps(String collection, String coreNodeName)
public Slice getSlice(String collection, String slice)
public Map<String,Slice> getSlices(String collection)
public Set<String> getCollections()
public Map<String,Map<String,Slice>> getCollectionStates()
public Set<String> getLiveNodes()
public String getShardId(String coreNodeName)
coreNodeName
- in the form of nodeName_coreNamepublic boolean liveNodesContain(String name)
public org.apache.solr.common.cloud.ClusterState.RangeInfo getRanges(String collection)
public String getShard(int hash, String collection)
public String toString()
toString
in class Object
public static ClusterState load(SolrZkClient zkClient, Set<String> liveNodes) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public static ClusterState load(Integer version, byte[] bytes, Set<String> liveNodes)
load(SolrZkClient, Set)
instead, unless you want to
do something more when getting the data - such as get the stat, set watch, etc.
version
- zk version of the clusterstate.json file (bytes)bytes
- clusterstate.json as a byte arrayliveNodes
- list of live nodes
public void write(JSONWriter jsonWriter)
write
in interface JSONWriter.Writable
public Integer getZkClusterStateVersion()
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |