Class PlacementRequestImpl

java.lang.Object
org.apache.solr.cluster.placement.impl.PlacementRequestImpl
All Implemented Interfaces:
ModificationRequest, PlacementRequest

public class PlacementRequestImpl extends Object implements PlacementRequest
  • Constructor Details

    • PlacementRequestImpl

      public PlacementRequestImpl(SolrCollection solrCollection, Set<String> shardNames, Set<Node> targetNodes, org.apache.solr.common.cloud.ReplicaCount numReplicas)
  • Method Details

    • getCollection

      public SolrCollection getCollection()
      Description copied from interface: ModificationRequest
      The SolrCollection to modify.
      Specified by:
      getCollection in interface ModificationRequest
    • getShardNames

      public Set<String> getShardNames()
      Description copied from interface: PlacementRequest
      Shard name(s) for which new replicas placement should be computed. The shard(s) might exist or not (that's why this method returns a Set of String's and not directly a set of Shard instances).

      Note the Collection API allows specifying the shard name or a _route_ parameter. The Solr implementation will convert either specification into the relevant shard name so the plugin code doesn't have to worry about this.

      Specified by:
      getShardNames in interface PlacementRequest
    • getTargetNodes

      public Set<Node> getTargetNodes()
      Description copied from interface: PlacementRequest
      Replicas should only be placed on nodes in the set returned by this method.

      When Collection API calls do not specify a specific set of target nodes, replicas can be placed on any live node of the cluster. In such cases, this set will be equal to the set of all live nodes. The plugin placement code does not need to worry (or care) if a set of nodes was explicitly specified or not.

      Specified by:
      getTargetNodes in interface PlacementRequest
      Returns:
      never null and never empty set (if that set was to be empty for any reason, no placement would be possible and the Solr infrastructure driving the plugin code would detect the error itself rather than calling the plugin).
    • getCountReplicasToCreate

      public int getCountReplicasToCreate(Replica.ReplicaType replicaType)
      Description copied from interface: PlacementRequest
      Returns the number of replica to create for the given replica type.
      Specified by:
      getCountReplicasToCreate in interface PlacementRequest