org.apache.solr.common.cloud

## Class PerReplicaStates

- java.lang.Object
- - org.apache.solr.common.cloud.PerReplicaStates

All Implemented Interfaces:
  MapSerializable, MapWriter, NavigableObject, ReflectMapWriter

    public class PerReplicaStates
    extends Object
    implements ReflectMapWriter

This represents the individual replica states in a collection This is an immutable object. When states are modified, a new instance is constructed

### Nested Class Summary

Nested Classes
`static class` `PerReplicaStates.Operation`
`static class` `PerReplicaStates.State` The state of a replica as stored as a node under /collections/collection-name/state.json/replica-state

### Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter

`MapWriter.EntryWriter`

### Field Summary

Fields
`int` `cversion`
`static int` `MAX_RETRIES`
`String` `path`
`static char` `SEPARATOR`
`SimpleMap<PerReplicaStates.State>` `states`

### Constructor Summary

Constructors
Constructor and Description
`PerReplicaStates(String path, int cversion, List<String> states)` Construct with data read from ZK

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`boolean` `allActive()` Check and return if all replicas are ACTIVE
`static PerReplicaStates` `fetch(String path, SolrZkClient zkClient, PerReplicaStates current)` Fetch the latest `PerReplicaStates` .
`static Set<String>` `findModifiedReplicas(PerReplicaStates old, PerReplicaStates fresh)` Get the changed replicas
`PerReplicaStates.State` `get(String replica)`
`static String` `getReplicaName(String s)`
`String` `toString()`

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

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

### Methods inherited from interface org.apache.solr.common.util.ReflectMapWriter

`writeMap`

### Methods inherited from interface org.apache.solr.common.MapWriter

`jsonStr, toMap`

### Methods inherited from interface org.apache.solr.common.NavigableObject

`_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size`

### Field Detail

#### SEPARATOR

    public static final char SEPARATOR

See Also:
  Constant Field Values

#### MAX_RETRIES

    public static final int MAX_RETRIES

See Also:
  Constant Field Values

#### path

    public final String path

#### cversion

    public final int cversion

#### states

    public final SimpleMap<PerReplicaStates.State> states

### Constructor Detail

#### PerReplicaStates

    public PerReplicaStates(String path,
                            int cversion,
                            List<String> states)

Construct with data read from ZK

Parameters:
  `path` - path from where this is loaded
  `cversion` - the current child version of the znode
  `states` - the per-replica states (the list of all child nodes)

### Method Detail

#### allActive

    public boolean allActive()

Check and return if all replicas are ACTIVE

#### findModifiedReplicas

    public static Set<String> findModifiedReplicas(PerReplicaStates old,
                                                   PerReplicaStates fresh)

Get the changed replicas

#### fetch

    public static PerReplicaStates fetch(String path,
                                         SolrZkClient zkClient,
                                         PerReplicaStates current)

Fetch the latest `PerReplicaStates` . It fetches data after checking the `Stat.getCversion()` of state.json. If this is not modified, the same object is returned

#### getReplicaName

    public static String getReplicaName(String s)

#### get

    public PerReplicaStates.State get(String replica)

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`