org.elasticsearch.index.shard.service
Class InternalIndexShard

java.lang.Object
  extended by org.elasticsearch.index.shard.AbstractIndexShardComponent
      extended by org.elasticsearch.index.shard.service.InternalIndexShard
All Implemented Interfaces:
IndexShardComponent, IndexShard, CloseableComponent

@ThreadSafe
public class InternalIndexShard
extends AbstractIndexShardComponent
implements IndexShard


Field Summary
 
Fields inherited from class org.elasticsearch.index.shard.AbstractIndexShardComponent
componentSettings, indexSettings, logger, shardId
 
Constructor Summary
InternalIndexShard(ShardId shardId, Settings indexSettings, Store store, Engine engine, Translog translog, ThreadPool threadPool, MapperService mapperService, IndexQueryParserService queryParserService, IndexCache indexCache)
           
 
Method Summary
 void close()
           
 long count(float minScore, byte[] querySource, java.lang.String queryParserName, java.lang.String... types)
           
 ParsedDocument create(java.lang.String type, java.lang.String id, byte[] source)
           
 void delete(java.lang.String type, java.lang.String id)
           
 void delete(org.apache.lucene.index.Term uid)
           
 void deleteByQuery(byte[] querySource, java.lang.String queryParserName, java.lang.String... types)
           
 Engine engine()
           
 SizeValue estimateFlushableMemorySize()
          Returns the estimated flushable memory size.
 void flush(Engine.Flush flush)
           
 byte[] get(java.lang.String type, java.lang.String id)
           
 boolean ignoreRecoveryAttempt()
          Returns true if this shard can ignore a recovery attempt made to it (since the already doing/done it)
 ParsedDocument index(java.lang.String type, java.lang.String id, byte[] source)
           
 void optimize(Engine.Optimize optimize)
           
 void performRecovery(java.lang.Iterable<Translog.Operation> operations)
           
 void performRecovery(Translog.Snapshot snapshot, boolean phase3)
           
 void readAllowed()
           
 void recover(Engine.RecoveryHandler recoveryHandler)
           
 IndexShardState recovering()
           
 void refresh(Engine.Refresh refresh)
           
 InternalIndexShard relocated()
           
 InternalIndexShard restoreRecoveryState(IndexShardState stateToRestore)
           
 ShardRouting routingEntry()
           
 InternalIndexShard routingEntry(ShardRouting shardRouting)
           
 Engine.Searcher searcher()
           
<T> T
snapshot(Engine.SnapshotHandler<T> snapshotHandler)
           
 InternalIndexShard start()
           
 IndexShardState state()
           
 Store store()
           
 Translog translog()
           
 void writeAllowed()
           
 
Methods inherited from class org.elasticsearch.index.shard.AbstractIndexShardComponent
indexSettings, managementGroupName, nodeName, shardId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.elasticsearch.index.shard.IndexShardComponent
indexSettings, shardId
 

Constructor Detail

InternalIndexShard

@Inject
public InternalIndexShard(ShardId shardId,
                                 @IndexSettings
                                 Settings indexSettings,
                                 Store store,
                                 Engine engine,
                                 Translog translog,
                                 ThreadPool threadPool,
                                 MapperService mapperService,
                                 IndexQueryParserService queryParserService,
                                 IndexCache indexCache)
Method Detail

store

public Store store()

engine

public Engine engine()

translog

public Translog translog()

routingEntry

public ShardRouting routingEntry()
Specified by:
routingEntry in interface IndexShard

routingEntry

public InternalIndexShard routingEntry(ShardRouting shardRouting)

recovering

public IndexShardState recovering()
                           throws IndexShardStartedException,
                                  IndexShardRelocatedException,
                                  IndexShardRecoveringException,
                                  IndexShardClosedException
Throws:
IndexShardStartedException
IndexShardRelocatedException
IndexShardRecoveringException
IndexShardClosedException

restoreRecoveryState

public InternalIndexShard restoreRecoveryState(IndexShardState stateToRestore)

relocated

public InternalIndexShard relocated()
                             throws IndexShardNotStartedException
Throws:
IndexShardNotStartedException

start

public InternalIndexShard start()
                         throws IndexShardStartedException,
                                IndexShardRelocatedException,
                                IndexShardClosedException
Throws:
IndexShardStartedException
IndexShardRelocatedException
IndexShardClosedException

state

public IndexShardState state()
Specified by:
state in interface IndexShard

estimateFlushableMemorySize

public SizeValue estimateFlushableMemorySize()
                                      throws ElasticSearchException
Returns the estimated flushable memory size. Returns null if not available.

Specified by:
estimateFlushableMemorySize in interface IndexShard
Throws:
ElasticSearchException

create

public ParsedDocument create(java.lang.String type,
                             java.lang.String id,
                             byte[] source)
                      throws ElasticSearchException
Specified by:
create in interface IndexShard
Throws:
ElasticSearchException

index

public ParsedDocument index(java.lang.String type,
                            java.lang.String id,
                            byte[] source)
                     throws ElasticSearchException
Specified by:
index in interface IndexShard
Throws:
ElasticSearchException

delete

public void delete(java.lang.String type,
                   java.lang.String id)
Specified by:
delete in interface IndexShard

delete

public void delete(org.apache.lucene.index.Term uid)
Specified by:
delete in interface IndexShard

deleteByQuery

public void deleteByQuery(byte[] querySource,
                          @Nullable
                          java.lang.String queryParserName,
                          java.lang.String... types)
                   throws ElasticSearchException
Specified by:
deleteByQuery in interface IndexShard
Throws:
ElasticSearchException

get

public byte[] get(java.lang.String type,
                  java.lang.String id)
           throws ElasticSearchException
Specified by:
get in interface IndexShard
Throws:
ElasticSearchException

count

public long count(float minScore,
                  byte[] querySource,
                  @Nullable
                  java.lang.String queryParserName,
                  java.lang.String... types)
           throws ElasticSearchException
Specified by:
count in interface IndexShard
Throws:
ElasticSearchException

refresh

public void refresh(Engine.Refresh refresh)
             throws ElasticSearchException
Specified by:
refresh in interface IndexShard
Throws:
ElasticSearchException

flush

public void flush(Engine.Flush flush)
           throws ElasticSearchException
Specified by:
flush in interface IndexShard
Throws:
ElasticSearchException

optimize

public void optimize(Engine.Optimize optimize)
              throws ElasticSearchException
Specified by:
optimize in interface IndexShard
Throws:
ElasticSearchException

snapshot

public <T> T snapshot(Engine.SnapshotHandler<T> snapshotHandler)
           throws EngineException
Specified by:
snapshot in interface IndexShard
Throws:
EngineException

recover

public void recover(Engine.RecoveryHandler recoveryHandler)
             throws EngineException
Specified by:
recover in interface IndexShard
Throws:
EngineException

searcher

public Engine.Searcher searcher()
Specified by:
searcher in interface IndexShard

close

public void close()
Specified by:
close in interface CloseableComponent

performRecovery

public void performRecovery(java.lang.Iterable<Translog.Operation> operations)
                     throws ElasticSearchException
Throws:
ElasticSearchException

performRecovery

public void performRecovery(Translog.Snapshot snapshot,
                            boolean phase3)
                     throws ElasticSearchException
Throws:
ElasticSearchException

ignoreRecoveryAttempt

public boolean ignoreRecoveryAttempt()
Returns true if this shard can ignore a recovery attempt made to it (since the already doing/done it)

Specified by:
ignoreRecoveryAttempt in interface IndexShard

readAllowed

public void readAllowed()
                 throws IllegalIndexShardStateException
Throws:
IllegalIndexShardStateException

writeAllowed

public void writeAllowed()
                  throws IllegalIndexShardStateException
Throws:
IllegalIndexShardStateException