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>, org.noggit.JSONWriter.Writable

      public class DocCollection
      extends ZkNodeProps
      implements Iterable<Slice>

  Models a Collection in zookeeper (but that Java name is obviously taken, hence "DocCollection")

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DOC_ROUTER`
    `static String` | `RULE`
    `static String` | `SHARDS`
    `static String` | `SNITCH`
    `static String` | `STATE_FORMAT`

    - ### Fields inherited from class org.apache.solr.common.cloud.ZkNodeProps

      `propMap`

  - ### Constructor Summary

    Constructors
    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)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    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)`
    `int` | `getMaxShardsPerNode()`
    `String` | `getName()` Return collection name.
    `Replica` | `getReplica(String coreNodeName)`
    `List<Replica>` | `getReplicas()`
    `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)`

    - ### Methods inherited from class org.apache.solr.common.cloud.ZkNodeProps

      `containsKey, fromKeyVals, get, getBool, getInt, getProperties, getStr, getStr, keySet, load, plus, plus, shallowCopy`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Field Detail

    - #### DOC_ROUTER

          public static final String DOC_ROUTER

      See Also:
        Constant Field Values

    - #### SHARDS

          public static final String SHARDS

      See Also:
        Constant Field Values

    - #### STATE_FORMAT

          public static final String STATE_FORMAT

      See Also:
        Constant Field Values

    - #### RULE

          public static final String RULE

      See Also:
        Constant Field Values

    - #### SNITCH

          public static final String SNITCH

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DocCollection

          public DocCollection(String name,
                               Map<String,Slice> slices,
                               Map<String,Object> props,
                               DocRouter router)

    - #### DocCollection

          public DocCollection(String name,
                               Map<String,Slice> slices,
                               Map<String,Object> props,
                               DocRouter router,
                               int zkVersion,
                               String znode)

      Parameters:
        `name` - The name of the collection
        `slices` - 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.

  - ### Method Detail

    - #### verifyProp

          public static Object verifyProp(Map<String,Object> props,
                                          String propName)

    - #### copyWithSlices

          public 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
      Parameters:
        `slices` - the new set of Slices
      Returns:
        the resulting DocCollection

    - #### getName

          public String getName()

      Return collection name.

    - #### getSlice

          public Slice getSlice(String sliceName)

    - #### getSlices

          public Collection<Slice> getSlices()

      Gets the list of all slices for this collection.

    - #### getActiveSlices

          public Collection<Slice> getActiveSlices()

      Return the list of active slices for this collection.

    - #### getSlicesMap

          public Map<String,Slice> getSlicesMap()

      Get the map of all slices (sliceName->Slice) for this collection.

    - #### getActiveSlicesMap

          public Map<String,Slice> getActiveSlicesMap()

      Get the map of active slices (sliceName->Slice) for this collection.

    - #### getZNodeVersion

          public int getZNodeVersion()

    - #### getStateFormat

          public int getStateFormat()

    - #### getReplicationFactor

          public Integer getReplicationFactor()

      Returns:
        replication factor for this collection or null if no replication factor exists.

    - #### getAutoAddReplicas

          public boolean getAutoAddReplicas()

    - #### getMaxShardsPerNode

          public int getMaxShardsPerNode()

    - #### getZNode

          public String getZNode()

    - #### getRouter

          public DocRouter getRouter()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `ZkNodeProps`

    - #### write

          public void write(org.noggit.JSONWriter jsonWriter)

      Specified by:
        `write` in interface `org.noggit.JSONWriter.Writable`
      Overrides:
        `write` in class `ZkNodeProps`

    - #### getReplica

          public Replica getReplica(String coreNodeName)

    - #### getLeader

          public Replica getLeader(String sliceName)

    - #### isFullyActive

          public static boolean isFullyActive(Set<String> liveNodes,
                                              DocCollection collectionState,
                                              int expectedShards,
                                              int expectedReplicas)

      Check that all replicas in a collection are live
      See Also:
        `CollectionStatePredicate`

    - #### iterator

          public Iterator<Slice> iterator()

      Specified by:
        `iterator` in interface `Iterable<Slice>`

    - #### getReplicas

          public List<Replica> getReplicas()

    - #### getShardId

          public String getShardId(String nodeName,
                                   String coreName)

      Get the shardId of a core on a specific node

    - #### equals

          public boolean equals(Object that)

      Overrides:
        `equals` in class `ZkNodeProps`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.