public class ImmutableShardRouting extends Object implements Streamable, Serializable, ShardRouting
ImmutableShardRouting immutably encapsulates information about shard
routings like id, state, version, etc.ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params| Modifier and Type | Field and Description |
|---|---|
protected String |
currentNodeId |
protected String |
index |
protected boolean |
primary |
protected String |
relocatingNodeId |
protected RestoreSource |
restoreSource |
protected int |
shardId |
protected ShardRoutingState |
state |
protected UnassignedInfo |
unassignedInfo |
protected long |
version |
EMPTY_PARAMS| Constructor and Description |
|---|
ImmutableShardRouting(ShardRouting copy) |
ImmutableShardRouting(ShardRouting copy,
long version) |
ImmutableShardRouting(String index,
int shardId,
String currentNodeId,
boolean primary,
ShardRoutingState state,
long version) |
ImmutableShardRouting(String index,
int shardId,
String currentNodeId,
String relocatingNodeId,
boolean primary,
ShardRoutingState state,
long version) |
ImmutableShardRouting(String index,
int shardId,
String currentNodeId,
String relocatingNodeId,
RestoreSource restoreSource,
boolean primary,
ShardRoutingState state,
long version) |
ImmutableShardRouting(String index,
int shardId,
String currentNodeId,
String relocatingNodeId,
RestoreSource restoreSource,
boolean primary,
ShardRoutingState state,
long version,
UnassignedInfo unassignedInfo) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
active()
|
boolean |
assignedToNode()
Returns
true iff this shard is assigned to a node ie. |
String |
currentNodeId()
The current node id the shard is allocated on.
|
boolean |
equals(Object o) |
int |
getId()
The shard id.
|
String |
getIndex()
The index name.
|
int |
hashCode() |
int |
id()
The shard id.
|
String |
index()
The index name.
|
boolean |
initializing()
The shard is initializing (usually recovering either from peer shard
or from gateway).
|
boolean |
primary()
Returns
true iff this shard is a primary. |
void |
readFrom(StreamInput in) |
void |
readFrom(StreamInput in,
String index,
int shardId) |
void |
readFromThin(StreamInput in) |
static ImmutableShardRouting |
readShardRoutingEntry(StreamInput in) |
static ImmutableShardRouting |
readShardRoutingEntry(StreamInput in,
String index,
int shardId) |
boolean |
relocating()
Returns
true iff the this shard is currently relocating to
another node. |
String |
relocatingNodeId()
The relocating node id the shard is either relocating to or relocating from.
|
RestoreSource |
restoreSource()
Snapshot id and repository where this shard is being restored from
|
ShardId |
shardId()
The shard id.
|
ShardIterator |
shardsIt()
A shard iterator with just this shard in it.
|
String |
shortSummary()
A short description of the shard.
|
boolean |
started()
The shard is in started mode.
|
ShardRoutingState |
state()
The shard state.
|
ShardRouting |
targetRoutingIfRelocating()
If the shard is relocating, return a shard routing representing the target shard or null o.w.
|
String |
toString() |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
boolean |
unassigned()
The shard is unassigned (not allocated to any node).
|
UnassignedInfo |
unassignedInfo()
Additional metadata on why the shard is/was unassigned.
|
long |
version()
The routing version associated with the shard.
|
void |
writeTo(StreamOutput out) |
void |
writeToThin(StreamOutput out)
Writes shard information to
StreamOutput without writing index name and shard id |
protected String index
protected int shardId
protected String currentNodeId
protected String relocatingNodeId
protected boolean primary
protected ShardRoutingState state
protected long version
protected RestoreSource restoreSource
protected UnassignedInfo unassignedInfo
public ImmutableShardRouting(ShardRouting copy)
public ImmutableShardRouting(ShardRouting copy, long version)
public ImmutableShardRouting(String index, int shardId, String currentNodeId, boolean primary, ShardRoutingState state, long version)
public ImmutableShardRouting(String index, int shardId, String currentNodeId, String relocatingNodeId, boolean primary, ShardRoutingState state, long version)
public ImmutableShardRouting(String index, int shardId, String currentNodeId, String relocatingNodeId, RestoreSource restoreSource, boolean primary, ShardRoutingState state, long version)
public ImmutableShardRouting(String index, int shardId, String currentNodeId, String relocatingNodeId, RestoreSource restoreSource, boolean primary, ShardRoutingState state, long version, UnassignedInfo unassignedInfo)
public String index()
ShardRoutingindex in interface ShardRoutingpublic String getIndex()
ShardRoutinggetIndex in interface ShardRoutingpublic int id()
ShardRoutingid in interface ShardRoutingpublic int getId()
ShardRoutinggetId in interface ShardRoutingpublic long version()
ShardRoutingversion in interface ShardRoutingpublic boolean unassigned()
ShardRoutingunassigned in interface ShardRoutingpublic boolean initializing()
ShardRoutinginitializing in interface ShardRoutingpublic boolean active()
ShardRoutingactive in interface ShardRoutingpublic boolean started()
ShardRoutingstarted in interface ShardRoutingpublic boolean relocating()
ShardRoutingtrue iff the this shard is currently relocating to
another node. Otherwise falserelocating in interface ShardRoutingShardRoutingState.RELOCATINGpublic boolean assignedToNode()
ShardRoutingassignedToNode in interface ShardRoutingpublic String currentNodeId()
ShardRoutingcurrentNodeId in interface ShardRoutingpublic String relocatingNodeId()
ShardRoutingrelocatingNodeId in interface ShardRoutingpublic ShardRouting targetRoutingIfRelocating()
ShardRoutingtargetRoutingIfRelocating in interface ShardRoutingpublic RestoreSource restoreSource()
ShardRoutingrestoreSource in interface ShardRouting@Nullable public UnassignedInfo unassignedInfo()
ShardRoutingunassignedInfo in interface ShardRoutingpublic boolean primary()
ShardRoutingtrue iff this shard is a primary.primary in interface ShardRoutingpublic ShardRoutingState state()
ShardRoutingstate in interface ShardRoutingpublic ShardId shardId()
ShardRoutingshardId in interface ShardRoutingpublic ShardIterator shardsIt()
ShardRoutingshardsIt in interface ShardRoutingpublic static ImmutableShardRouting readShardRoutingEntry(StreamInput in) throws IOException
IOExceptionpublic static ImmutableShardRouting readShardRoutingEntry(StreamInput in, String index, int shardId) throws IOException
IOExceptionpublic void readFrom(StreamInput in, String index, int shardId) throws IOException
IOExceptionpublic void readFromThin(StreamInput in) throws IOException
readFromThin in interface ShardRoutingIOExceptionpublic void readFrom(StreamInput in) throws IOException
readFrom in interface StreamableIOExceptionpublic void writeToThin(StreamOutput out) throws IOException
StreamOutput without writing index name and shard idwriteToThin in interface ShardRoutingout - StreamOutput to write shard information toIOException - if something happens during writepublic void writeTo(StreamOutput out) throws IOException
writeTo in interface StreamableIOExceptionpublic String shortSummary()
ShardRoutingshortSummary in interface ShardRoutingpublic XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
toXContent in interface ToXContentIOExceptionCopyright © 2009–2016. All rights reserved.