Package org.apache.solr.common.cloud
Class DocCollection
java.lang.Object
org.apache.solr.common.cloud.ZkNodeProps
org.apache.solr.common.cloud.DocCollection
- All Implemented Interfaces:
Iterable<Slice>,MapSerializable,MapWriter,NavigableObject,org.noggit.JSONWriter.Writable
Models a Collection in zookeeper (but that Java name is obviously taken, hence "DocCollection")
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceJSON properties related to a collection's state.static interfaceNested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
MapWriter.EntryWriter -
Field Summary
FieldsFields inherited from class org.apache.solr.common.cloud.ZkNodeProps
propMap -
Method Summary
Modifier and TypeMethodDescriptioncopyWithSlices(Map<String, Slice> slices) Use this to make an exact copy of DocCollection with a new set of Slices and every other property as isstatic DocCollectioncreate(String name, Map<String, Slice> slices, Map<String, Object> props, DocRouter router, int zkVersion, Instant creationTime, DocCollection.PrsSupplier prsSupplier) Builds a DocCollection with an optional PrsSupplierbooleanvoidforEachReplica(BiConsumer<String, Replica> consumer) Return the list of active slices for this collection.Get the map of active slices (sliceName->Slice) for this collection.intstatic StringgetCollectionPath(String coll) static StringgetCollectionPathRoot(String coll) Return non-null config nameThe creation time of the Collection.getName()Return collection name.intgetNumReplicas(Replica.Type type) getReplica(String coreNodeName) Deprecated.getReplicasOnNode(String nodeName) Get the list of replicas hosted on the given node, or an empty list if none.Gets the list of all slices for this collection.Get the map of all slices (sliceName->Slice) for this collection.getZNode()intinthashCode()booleanisModified(int dataVersion, int childVersion) booleanbooleaniterator()final DocCollectionsetPerReplicaStates(PerReplicaStates newPerReplicaStates) Update our state with a state of aPerReplicaStateswhich could override states ofReplica.toString()static ObjectverifyProp(Map<String, Object> props, String propName) voidWrites this object's entries out toew.Methods inherited from class org.apache.solr.common.cloud.ZkNodeProps
containsKey, get, getBool, getInt, getProperties, getStr, getStr, keySet, load, plus, plus, shallowCopyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
-
Field Details
-
COLLECTIONS_ZKNODE
- See Also:
-
-
Method Details
-
create
public static DocCollection create(String name, Map<String, Slice> slices, Map<String, Object> props, DocRouter router, int zkVersion, Instant creationTime, DocCollection.PrsSupplier prsSupplier) Builds a DocCollection with an optional PrsSupplier- Parameters:
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.router- router to partition int range into n rangeszkVersion- The version of the Collection node in Zookeeper (used for conditional updates).creationTime- The creation time of the collectionprsSupplier- optional supplier for PerReplicaStates (PRS) for PRS enabled collections- Returns:
- a newly constructed DocCollection
-
getCollectionPath
-
getCollectionPathRoot
-
setPerReplicaStates
Update our state with a state of aPerReplicaStateswhich could override states ofReplica.Take note that it updates the underlying AtomicReference such that all Slice and Replica that holds the same AtomicReference will see the same update
This does not create a new DocCollection.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
verifyProp
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
copyWithSlices
Use this to make an exact copy of DocCollection with a new set of Slices and every other property as is- Parameters:
slices- the new set of Slices- Returns:
- the resulting DocCollection
-
getName
Return collection name. -
getConfigName
Return non-null config name -
getSlice
-
forEachReplica
- Parameters:
consumer- consume shardName vs. replica
-
getSlices
Gets the list of all slices for this collection. -
getActiveSlices
Return the list of active slices for this collection. -
getSlicesMap
Get the map of all slices (sliceName->Slice) for this collection. -
getActiveSlicesMap
Get the map of active slices (sliceName->Slice) for this collection. -
getReplicasOnNode
Get the list of replicas hosted on the given node, or an empty list if none. -
getZNodeVersion
public int getZNodeVersion() -
getChildNodesVersion
public int getChildNodesVersion() -
isModified
public boolean isModified(int dataVersion, int childVersion) -
getReplicationFactor
- Returns:
- replication factor for this collection or null if no replication factor exists.
-
getZNode
-
getRouter
-
isReadOnly
public boolean isReadOnly() -
getCreationTime
The creation time of the Collection. When this collection is read from ZooKeeper, this is the creation time of the collection node. -
toString
- Overrides:
toStringin classZkNodeProps
-
writeMap
Description copied from interface:MapWriterWrites this object's entries out toew.- Specified by:
writeMapin interfaceMapWriter- Overrides:
writeMapin classZkNodeProps- Throws:
IOException
-
getReplica
-
getLeader
-
iterator
-
getReplicas
Deprecated. -
equals
- Overrides:
equalsin classZkNodeProps
-
hashCode
public int hashCode()- Overrides:
hashCodein classZkNodeProps
-
getNumReplicas
- Returns:
- the number of replicas of a given type this collection was created with
-
isPerReplicaState
public boolean isPerReplicaState() -
getPerReplicaStates
-