public class Slice extends ZkNodeProps implements Iterable<Replica>
Modifier and Type | Class and Description |
---|---|
static class |
Slice.State
The slice's state.
|
Modifier and Type | Field and Description |
---|---|
static String |
LEADER |
static String |
PARENT |
static String |
RANGE |
static String |
REPLICAS |
propMap
Constructor and Description |
---|
Slice(String name,
Map<String,Replica> replicas,
Map<String,Object> props) |
Modifier and Type | Method and Description |
---|---|
Replica |
getLeader() |
String |
getName()
Return slice name (shard id).
|
String |
getParent() |
DocRouter.Range |
getRange() |
Replica |
getReplica(String replicaName) |
Collection<Replica> |
getReplicas()
Gets the list of all replicas for this slice.
|
List<Replica> |
getReplicas(EnumSet<Replica.Type> s)
Gets the list of replicas that have a type present in s
|
List<Replica> |
getReplicas(Predicate<Replica> pred)
Gets all replicas that match a predicate
|
Map<String,Replica> |
getReplicasCopy() |
Map<String,Replica> |
getReplicasMap()
Get the map of coreNodeName to replicas for this slice.
|
Map<String,RoutingRule> |
getRoutingRules() |
Slice.State |
getState() |
Iterator<Replica> |
iterator() |
static Map<String,Slice> |
loadAllFromMap(Map<String,Object> genericSlices)
Loads multiple slices into a Map from a generic Map that probably came from deserialized JSON.
|
String |
toString() |
void |
write(org.noggit.JSONWriter jsonWriter) |
containsKey, equals, 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 REPLICAS
public static final String RANGE
public static final String LEADER
public static final String PARENT
public Slice(String name, Map<String,Replica> replicas, Map<String,Object> props)
name
- The name of the slicereplicas
- The replicas of the slice. This is used directly and a copy is not made. If null, replicas will be constructed from props.props
- The properties of the slice - a shallow copy will always be made.public static Map<String,Slice> loadAllFromMap(Map<String,Object> genericSlices)
public String getName()
public Collection<Replica> getReplicas()
public List<Replica> getReplicas(Predicate<Replica> pred)
public List<Replica> getReplicas(EnumSet<Replica.Type> s)
public Map<String,Replica> getReplicasMap()
public Replica getLeader()
public DocRouter.Range getRange()
public Slice.State getState()
public String getParent()
public Map<String,RoutingRule> getRoutingRules()
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
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.