public class DocCollection extends ZkNodeProps implements Iterable<Slice>
Modifier and Type | Field and Description |
---|---|
static String |
DOC_ROUTER |
static String |
RULE |
static String |
SHARDS |
static String |
SNITCH |
static String |
STATE_FORMAT |
propMap
Constructor and Description |
---|
DocCollection(String name,
Map<String,Slice> slices,
Map<String,Object> props,
DocRouter router) |
DocCollection(String name,
Map<String,Slice> slices,
Map<String,Object> props,
DocRouter router,
int zkVersion,
String znode) |
Modifier and Type | Method and Description |
---|---|
DocCollection |
copyWithSlices(Map<String,Slice> slices)
Use this to make an exact copy of DocCollection with a new set of Slices and every other property as is
|
boolean |
equals(Object that) |
Collection<Slice> |
getActiveSlices()
Return the list of active slices for this collection.
|
Map<String,Slice> |
getActiveSlicesMap()
Get the map of active slices (sliceName->Slice) for this collection.
|
boolean |
getAutoAddReplicas() |
Replica |
getLeader(String sliceName) |
List<Replica> |
getLeaderReplicas(String nodeName)
Get the list of all leaders hosted on the given node or
null if none. |
int |
getMaxShardsPerNode() |
String |
getName()
Return collection name.
|
Replica |
getReplica(String coreNodeName) |
List<Replica> |
getReplicas() |
List<Replica> |
getReplicas(String nodeName)
Get the list of replicas hosted on the given node or
null if none. |
Integer |
getReplicationFactor() |
DocRouter |
getRouter() |
String |
getShardId(String nodeName,
String coreName)
Get the shardId of a core on a specific node
|
Slice |
getSlice(String sliceName) |
Collection<Slice> |
getSlices()
Gets the list of all slices for this collection.
|
Map<String,Slice> |
getSlicesMap()
Get the map of all slices (sliceName->Slice) for this collection.
|
int |
getStateFormat() |
String |
getZNode() |
int |
getZNodeVersion() |
static boolean |
isFullyActive(Set<String> liveNodes,
DocCollection collectionState,
int expectedShards,
int expectedReplicas)
Check that all replicas in a collection are live
|
Iterator<Slice> |
iterator() |
String |
toString() |
static Object |
verifyProp(Map<String,Object> props,
String propName) |
void |
write(org.noggit.JSONWriter jsonWriter) |
containsKey, fromKeyVals, get, getBool, getInt, getProperties, getStr, getStr, keySet, load, plus, plus, shallowCopy
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final String DOC_ROUTER
public static final String SHARDS
public static final String STATE_FORMAT
public static final String RULE
public static final String SNITCH
public DocCollection(String name, Map<String,Slice> slices, Map<String,Object> props, DocRouter router)
public DocCollection(String name, Map<String,Slice> slices, Map<String,Object> props, DocRouter router, int zkVersion, String znode)
name
- The name of the collectionslices
- The logical shards of the collection. This is used directly and a copy is not made.props
- The properties of the slice. This is used directly and a copy is not made.public DocCollection copyWithSlices(Map<String,Slice> slices)
slices
- the new set of Slicespublic String getName()
public Collection<Slice> getSlices()
public Collection<Slice> getActiveSlices()
public Map<String,Slice> getSlicesMap()
public Map<String,Slice> getActiveSlicesMap()
public List<Replica> getReplicas(String nodeName)
null
if none.public List<Replica> getLeaderReplicas(String nodeName)
null
if none.public int getZNodeVersion()
public int getStateFormat()
public Integer getReplicationFactor()
public boolean getAutoAddReplicas()
public int getMaxShardsPerNode()
public String getZNode()
public DocRouter getRouter()
public String toString()
toString
in class ZkNodeProps
public void write(org.noggit.JSONWriter jsonWriter)
write
in interface org.noggit.JSONWriter.Writable
write
in class ZkNodeProps
public static boolean isFullyActive(Set<String> liveNodes, DocCollection collectionState, int expectedShards, int expectedReplicas)
CollectionStatePredicate
public String getShardId(String nodeName, String coreName)
public boolean equals(Object that)
equals
in class ZkNodeProps
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.