org.elasticsearch.cluster.routing
Class ImmutableShardRouting

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

public class ImmutableShardRouting
extends Object
implements Streamable, Serializable, ShardRouting

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Field Summary
protected  String currentNodeId
           
protected  String index
           
protected  boolean primary
           
protected  String relocatingNodeId
           
protected  int shardId
           
protected  ShardRoutingState state
           
protected  long version
           
 
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
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)
           
 
Method Summary
 boolean active()
          Relocating or started.
 boolean assignedToNode()
          The shard is assigned to a node.
 String currentNodeId()
          The current node id the shard is allocated to.
 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()
          Is this a primary shard.
 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()
          The shard is in relocating mode.
 String relocatingNodeId()
          The relocating node id the shard is either relocating to or relocating 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.
 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)
          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 String index

shardId

protected int shardId

currentNodeId

protected String currentNodeId

relocatingNodeId

protected String relocatingNodeId

primary

protected boolean primary

state

protected ShardRoutingState state

version

protected long version
Constructor Detail

ImmutableShardRouting

public ImmutableShardRouting(ShardRouting copy)

ImmutableShardRouting

public ImmutableShardRouting(ShardRouting copy,
                             long version)

ImmutableShardRouting

public ImmutableShardRouting(String index,
                             int shardId,
                             String currentNodeId,
                             String relocatingNodeId,
                             boolean primary,
                             ShardRoutingState state,
                             long version)

ImmutableShardRouting

public ImmutableShardRouting(String index,
                             int shardId,
                             String currentNodeId,
                             boolean primary,
                             ShardRoutingState state,
                             long version)
Method Detail

index

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

Specified by:
index in interface ShardRouting

getIndex

public 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

version

public long version()
Description copied from interface: ShardRouting
The routing version associated with the shard.

Specified by:
version 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 String currentNodeId()
Description copied from interface: ShardRouting
The current node id the shard is allocated to.

Specified by:
currentNodeId in interface ShardRouting

relocatingNodeId

public 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 ShardIterator 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 IOException
Throws:
IOException

readShardRoutingEntry

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

readFrom

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

readFromThin

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

readFrom

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

writeToThin

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

Specified by:
writeToThin in interface ShardRouting
Throws:
IOException

writeTo

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

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

shortSummary

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

Specified by:
shortSummary in interface ShardRouting

toXContent

public XContentBuilder toXContent(XContentBuilder builder,
                                  ToXContent.Params params)
                           throws IOException
Specified by:
toXContent in interface ToXContent
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.