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 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) |
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).
|
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
public ImmutableShardRouting(ShardRouting copy)
public ImmutableShardRouting(ShardRouting copy, 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, boolean primary, ShardRoutingState state, long version)
public String index()
ShardRouting
index
in interface ShardRouting
public String getIndex()
ShardRouting
getIndex
in interface ShardRouting
public int id()
ShardRouting
id
in interface ShardRouting
public int getId()
ShardRouting
getId
in interface ShardRouting
public long version()
ShardRouting
version
in interface ShardRouting
public boolean unassigned()
ShardRouting
unassigned
in interface ShardRouting
public boolean initializing()
ShardRouting
initializing
in interface ShardRouting
public boolean active()
ShardRouting
active
in interface ShardRouting
public boolean started()
ShardRouting
started
in interface ShardRouting
public boolean relocating()
ShardRouting
true
iff the this shard is currently relocating to
another node. Otherwise false
relocating
in interface ShardRouting
ShardRoutingState.RELOCATING
public boolean assignedToNode()
ShardRouting
assignedToNode
in interface ShardRouting
public String currentNodeId()
ShardRouting
currentNodeId
in interface ShardRouting
public String relocatingNodeId()
ShardRouting
relocatingNodeId
in interface ShardRouting
public ShardRouting targetRoutingIfRelocating()
ShardRouting
targetRoutingIfRelocating
in interface ShardRouting
public RestoreSource restoreSource()
ShardRouting
restoreSource
in interface ShardRouting
public boolean primary()
ShardRouting
true
iff this shard is a primary.primary
in interface ShardRouting
public ShardRoutingState state()
ShardRouting
state
in interface ShardRouting
public ShardId shardId()
ShardRouting
shardId
in interface ShardRouting
public ShardIterator shardsIt()
ShardRouting
shardsIt
in interface ShardRouting
public static ImmutableShardRouting readShardRoutingEntry(StreamInput in) throws IOException
IOException
public static ImmutableShardRouting readShardRoutingEntry(StreamInput in, String index, int shardId) throws IOException
IOException
public void readFrom(StreamInput in, String index, int shardId) throws IOException
IOException
public void readFromThin(StreamInput in) throws IOException
readFromThin
in interface ShardRouting
IOException
public void readFrom(StreamInput in) throws IOException
readFrom
in interface Streamable
IOException
public void writeToThin(StreamOutput out) throws IOException
StreamOutput
without writing index name and shard idwriteToThin
in interface ShardRouting
out
- StreamOutput
to write shard information toIOException
- if something happens during writepublic void writeTo(StreamOutput out) throws IOException
writeTo
in interface Streamable
IOException
public String shortSummary()
ShardRouting
shortSummary
in interface ShardRouting
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
toXContent
in interface ToXContent
IOException
Copyright © 2009–2015. All rights reserved.