Package org.apache.solr.common.cloud

# Class PerReplicaStates

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

All Implemented Interfaces:
  `MapSerializable`, `MapWriter`, `NavigableObject`, `ReflectMapWriter`, `org.noggit.JSONWriter.Writable`

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
Modifier and Type
Class
Description
`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
Modifier and Type
Field
Description
`final int`
`cversion`
`static final int`
`MAX_RETRIES`
`final String`
`path`
`static final char`
`SEPARATOR`
`final Map<String,PerReplicaStates.State>`
`states`

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

`EMPTY`

## Constructor Summary

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

## Method Summary

Modifier and Type
Method
Description
`boolean`
`allActive()`
Check and return if all replicas are ACTIVE
`static PerReplicaStates`
`empty(String collectionName)`
`static Set<String>`
`findModifiedReplicas(PerReplicaStates old, PerReplicaStates fresh)`
Get the changed replicas
`PerReplicaStates.State`
`get(String replica)`
`static String`
`getReplicaName(String s)`
`String`
`toString()`
`void`
`writeMap(MapWriter.EntryWriter ew)`
Writes this object's entries out to `ew`.

### 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.MapWriter

`jsonStr, toMap, write`

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

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

## Field Details

### 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 Map<String,PerReplicaStates.State> states

## Constructor Details

### 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 Details

### empty

public static PerReplicaStates empty(String collectionName)

### 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

### getReplicaName

public static String getReplicaName(String s)

### get

public PerReplicaStates.State get(String replica)

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### writeMap

public void writeMap(MapWriter.EntryWriter ew) throws IOException
Description copied from interface: `MapWriter`
Writes this object's entries out to `ew`.

Specified by:
  `writeMap` in interface `MapWriter`
Specified by:
  `writeMap` in interface `ReflectMapWriter`
Throws:
  `IOException`