org.elasticsearch.cluster.routing
Class ImmutableShardRouting

java.lang.Object
  extended by org.elasticsearch.cluster.routing.ImmutableShardRouting
All Implemented Interfaces:
java.io.Serializable, ShardRouting, Streamable
Direct Known Subclasses:
MutableShardRouting

public class ImmutableShardRouting
extends java.lang.Object
implements Streamable, java.io.Serializable, ShardRouting

See Also:
Serialized Form

Field Summary
protected  java.lang.String currentNodeId
           
protected  java.lang.String index
           
protected  boolean primary
           
protected  java.lang.String relocatingNodeId
           
protected  int shardId
           
protected  ShardRoutingState state
           
 
Constructor Summary
ImmutableShardRouting()
           
ImmutableShardRouting(ShardRouting copy)
           
ImmutableShardRouting(java.lang.String index, int shardId, java.lang.String currentNodeId, boolean primary, ShardRoutingState state)
           
ImmutableShardRouting(java.lang.String index, int shardId, java.lang.String currentNodeId, java.lang.String relocatingNodeId, boolean primary, ShardRoutingState state)
           
 
Method Summary
 boolean active()
          Relocating or started.
 boolean assignedToNode()
          The shard is assigned to a node.
 java.lang.String currentNodeId()
          The current node id the shard is allocated to.
 boolean equals(java.lang.Object o)
           
 int getId()
          The shard id.
 java.lang.String getIndex()
          The index name.
 int hashCode()
           
 int id()
          The shard id.
 java.lang.String index()
          The index name.
 boolean initializing()
          The shard is initializing (usually recovering either from peer shard or from gateway).
 boolean primary()
          Is this a primary shard.
 void readFrom(StreamInput in)
           
 void readFrom(StreamInput in, java.lang.String index, int shardId)
           
 void readFromThin(StreamInput in)
           
static ImmutableShardRouting readShardRoutingEntry(StreamInput in)
           
static ImmutableShardRouting readShardRoutingEntry(StreamInput in, java.lang.String index, int shardId)
           
 boolean relocating()
          The shard is in relocating mode.
 java.lang.String relocatingNodeId()
          The relocating node id the shard is either relocating to or relocating from.
 ShardId shardId()
          The shard id.
 ShardsIterator shardsIt()
          A shard iterator with just this shard in it.
 java.lang.String shortSummary()
          A short description of the shard.
 boolean started()
          The shard is in started mode.
 ShardRoutingState state()
          The shard state.
 java.lang.String toString()
           
 boolean unassigned()
          The shard is unassigned (not allocated to any node).
 void writeTo(StreamOutput out)
           
 void writeToThin(StreamOutput out)
          Does not write index name and shard id
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

index

protected java.lang.String index

shardId

protected int shardId

currentNodeId

protected java.lang.String currentNodeId

relocatingNodeId

protected java.lang.String relocatingNodeId

primary

protected boolean primary

state

protected ShardRoutingState state
Constructor Detail

ImmutableShardRouting

public ImmutableShardRouting()

ImmutableShardRouting

public ImmutableShardRouting(ShardRouting copy)

ImmutableShardRouting

public ImmutableShardRouting(java.lang.String index,
                             int shardId,
                             java.lang.String currentNodeId,
                             boolean primary,
                             ShardRoutingState state)

ImmutableShardRouting

public ImmutableShardRouting(java.lang.String index,
                             int shardId,
                             java.lang.String currentNodeId,
                             java.lang.String relocatingNodeId,
                             boolean primary,
                             ShardRoutingState state)
Method Detail

index

public java.lang.String index()
Description copied from interface: ShardRouting
The index name.

Specified by:
index in interface ShardRouting

getIndex

public java.lang.String getIndex()
Description copied from interface: ShardRouting
The index name.

Specified by:
getIndex in interface ShardRouting

id

public int id()
Description copied from interface: ShardRouting
The shard id.

Specified by:
id in interface ShardRouting

getId

public int getId()
Description copied from interface: ShardRouting
The shard id.

Specified by:
getId in interface ShardRouting

unassigned

public boolean unassigned()
Description copied from interface: ShardRouting
The shard is unassigned (not allocated to any node).

Specified by:
unassigned in interface ShardRouting

initializing

public boolean initializing()
Description copied from interface: ShardRouting
The shard is initializing (usually recovering either from peer shard or from gateway).

Specified by:
initializing in interface ShardRouting

active

public boolean active()
Description copied from interface: ShardRouting
Relocating or started.

Specified by:
active in interface ShardRouting

started

public boolean started()
Description copied from interface: ShardRouting
The shard is in started mode.

Specified by:
started in interface ShardRouting

relocating

public boolean relocating()
Description copied from interface: ShardRouting
The shard is in relocating mode.

Specified by:
relocating in interface ShardRouting

assignedToNode

public boolean assignedToNode()
Description copied from interface: ShardRouting
The shard is assigned to a node.

Specified by:
assignedToNode in interface ShardRouting

currentNodeId

public java.lang.String currentNodeId()
Description copied from interface: ShardRouting
The current node id the shard is allocated to.

Specified by:
currentNodeId in interface ShardRouting

relocatingNodeId

public java.lang.String relocatingNodeId()
Description copied from interface: ShardRouting
The relocating node id the shard is either relocating to or relocating from.

Specified by:
relocatingNodeId in interface ShardRouting

primary

public boolean primary()
Description copied from interface: ShardRouting
Is this a primary shard.

Specified by:
primary in interface ShardRouting

state

public ShardRoutingState state()
Description copied from interface: ShardRouting
The shard state.

Specified by:
state in interface ShardRouting

shardId

public ShardId shardId()
Description copied from interface: ShardRouting
The shard id.

Specified by:
shardId in interface ShardRouting

shardsIt

public ShardsIterator shardsIt()
Description copied from interface: ShardRouting
A shard iterator with just this shard in it.

Specified by:
shardsIt in interface ShardRouting

readShardRoutingEntry

public static ImmutableShardRouting readShardRoutingEntry(StreamInput in)
                                                   throws java.io.IOException
Throws:
java.io.IOException

readShardRoutingEntry

public static ImmutableShardRouting readShardRoutingEntry(StreamInput in,
                                                          java.lang.String index,
                                                          int shardId)
                                                   throws java.io.IOException
Throws:
java.io.IOException

readFrom

public void readFrom(StreamInput in,
                     java.lang.String index,
                     int shardId)
              throws java.io.IOException
Throws:
java.io.IOException

readFromThin

public void readFromThin(StreamInput in)
                  throws java.io.IOException
Specified by:
readFromThin in interface ShardRouting
Throws:
java.io.IOException

readFrom

public void readFrom(StreamInput in)
              throws java.io.IOException
Specified by:
readFrom in interface Streamable
Throws:
java.io.IOException

writeToThin

public void writeToThin(StreamOutput out)
                 throws java.io.IOException
Does not write index name and shard id

Specified by:
writeToThin in interface ShardRouting
Throws:
java.io.IOException

writeTo

public void writeTo(StreamOutput out)
             throws java.io.IOException
Specified by:
writeTo in interface Streamable
Throws:
java.io.IOException

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

shortSummary

public java.lang.String shortSummary()
Description copied from interface: ShardRouting
A short description of the shard.

Specified by:
shortSummary in interface ShardRouting