public class ClusterState extends Object implements org.noggit.JSONWriter.Writable
ZkStateReader.getClusterState().| Modifier and Type | Class and Description | 
|---|---|
| static class  | ClusterState.CollectionRef | 
| Constructor and Description | 
|---|
| ClusterState(Integer znodeVersion,
            Set<String> liveNodes,
            Map<String,DocCollection> collectionStates)Use this constr when ClusterState is meant for consumption. | 
| ClusterState(Set<String> liveNodes,
            Map<String,ClusterState.CollectionRef> collectionStates,
            Integer znodeVersion)Use this if all the collection states are not readily available and some needs to be lazily loaded | 
| Modifier and Type | Method and Description | 
|---|---|
| ClusterState | copyWith(String collectionName,
        DocCollection collection)Returns a new cluster state object modified with the given collection. | 
| boolean | equals(Object obj) | 
| Collection<Slice> | getActiveSlices(String collection)Deprecated. 
 use  DocCollection.getActiveSlices()instead | 
| Map<String,Slice> | getActiveSlicesMap(String collection)Deprecated. 
 use  DocCollection.getActiveSlicesMap()instead | 
| DocCollection | getCollection(String collection)Get the named DocCollection object, or throw an exception if it doesn't exist. | 
| DocCollection | getCollectionOrNull(String collectionName)Returns the corresponding  DocCollectionobject for the given collection name
 if such a collection exists. | 
| ClusterState.CollectionRef | getCollectionRef(String coll) | 
| Set<String> | getCollections()Deprecated. 
 use  getCollectionsMap()to avoid a second lookup for lazy collections | 
| Map<String,DocCollection> | getCollectionsMap()Get a map of collection name vs DocCollection objects
 Implementation note: This method resolves the collection reference by calling
  ClusterState.CollectionRef.get()which can make a call to ZooKeeper. | 
| Map<String,ClusterState.CollectionRef> | getCollectionStates()Be aware that this may return collections which may not exist now. | 
| Replica | getLeader(String collection,
         String sliceName)Deprecated. 
 Use  DocCollection.getLeader(String)instead | 
| Set<String> | getLiveNodes()Get names of the currently live nodes. | 
| Replica | getReplica(String collection,
          String coreNodeName)Deprecated. 
 use  DocCollection.getReplica(String)instead | 
| String | getShardId(String nodeName,
          String coreName) | 
| String | getShardId(String collectionName,
          String nodeName,
          String coreName) | 
| Slice | getSlice(String collection,
        String sliceName)Deprecated. 
 use  DocCollection.getSlice(String)instead | 
| Collection<Slice> | getSlices(String collection)Deprecated. 
 use  DocCollection.getSlices()instead | 
| Map<String,Slice> | getSlicesMap(String collection)Deprecated. 
 use  DocCollection.getSlicesMap()instead | 
| Integer | getZkClusterStateVersion()Deprecated. 
 true cluster state spans many ZK nodes, stop depending on the version number of the shared node! | 
| boolean | hasCollection(String collectionName)Returns true if the specified collection name exists, false otherwise. | 
| int | hashCode() | 
| boolean | liveNodesContain(String name)Check if node is alive. | 
| static Aliases | load(byte[] bytes) | 
| static ClusterState | load(Integer version,
    byte[] bytes,
    Set<String> liveNodes) | 
| static ClusterState | load(Integer version,
    byte[] bytes,
    Set<String> liveNodes,
    String znode)Create ClusterState from json string that is typically stored in zookeeper. | 
| String | toString() | 
| void | write(org.noggit.JSONWriter jsonWriter) | 
public ClusterState(Integer znodeVersion, Set<String> liveNodes, Map<String,DocCollection> collectionStates)
public ClusterState copyWith(String collectionName, DocCollection collection)
collectionName - the name of the modified (or deleted) collectioncollection - the collection object. A null value deletes the collection from the state@Deprecated public Replica getLeader(String collection, String sliceName)
DocCollection.getLeader(String) insteadpublic boolean hasCollection(String collectionName)
ClusterState.CollectionRef.get() which can make a call to ZooKeeper. This is necessary
 because the semantics of how collection list is loaded have changed in SOLR-6629.
 Please see javadocs in ZkStateReader.refreshCollectionList(Watcher)@Deprecated public Replica getReplica(String collection, String coreNodeName)
DocCollection.getReplica(String) instead@Deprecated public Slice getSlice(String collection, String sliceName)
DocCollection.getSlice(String) instead@Deprecated public Map<String,Slice> getSlicesMap(String collection)
DocCollection.getSlicesMap() instead@Deprecated public Map<String,Slice> getActiveSlicesMap(String collection)
DocCollection.getActiveSlicesMap() instead@Deprecated public Collection<Slice> getSlices(String collection)
DocCollection.getSlices() instead@Deprecated public Collection<Slice> getActiveSlices(String collection)
DocCollection.getActiveSlices() insteadpublic DocCollection getCollection(String collection)
public ClusterState.CollectionRef getCollectionRef(String coll)
public DocCollection getCollectionOrNull(String collectionName)
DocCollection object for the given collection name
 if such a collection exists. Returns null otherwise.
 Implementation note: This method resolves the collection reference by calling
 ClusterState.CollectionRef.get() which may make a call to ZooKeeper. This is necessary
 because the semantics of how collection list is loaded have changed in SOLR-6629.
 Please see javadocs in ZkStateReader.refreshCollectionList(Watcher)@Deprecated public Set<String> getCollections()
getCollectionsMap() to avoid a second lookup for lazy collectionsClusterState.CollectionRef.get() which can make a call to ZooKeeper. This is necessary
 because the semantics of how collection list is loaded have changed in SOLR-6629.
 Please see javadocs in ZkStateReader.refreshCollectionList(Watcher)public Map<String,DocCollection> getCollectionsMap()
ClusterState.CollectionRef.get() which can make a call to ZooKeeper. This is necessary
 because the semantics of how collection list is loaded have changed in SOLR-6629.
 Please see javadocs in ZkStateReader.refreshCollectionList(Watcher)public boolean liveNodesContain(String name)
public static ClusterState load(Integer version, byte[] bytes, Set<String> liveNodes)
public static ClusterState load(Integer version, byte[] bytes, Set<String> liveNodes, String znode)
version - zk version of the clusterstate.json file (bytes)bytes - clusterstate.json as a byte arrayliveNodes - list of live nodespublic static Aliases load(byte[] bytes)
public void write(org.noggit.JSONWriter jsonWriter)
write in interface org.noggit.JSONWriter.Writable@Deprecated public Integer getZkClusterStateVersion()
public Map<String,ClusterState.CollectionRef> getCollectionStates()
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.