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

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, IndexSettingsService indexSettingsService, IndicesLifecycle indicesLifecycle, Store store, Engine engine, MergeSchedulerProvider mergeScheduler, Translog translog, ThreadPool threadPool, MapperService mapperService, IndexQueryParserService queryParserService, IndexCache indexCache, IndexAliasesService indexAliasesService, ShardIndexingService indexingService, ShardGetService getService, ShardSearchService searchService, ShardIndexWarmerService shardWarmerService)
           
 
Method Summary
 long checkIndexTook()
           
 void close(String reason)
           
 ParsedDocument create(Engine.Create create)
           
 void delete(Engine.Delete delete)
           
 void deleteByQuery(Engine.DeleteByQuery deleteByQuery)
           
 DocsStats docStats()
           
 Engine engine()
           
 void flush(Engine.Flush flush)
           
 FlushStats flushStats()
           
 Engine.GetResult get(Engine.Get get)
           
 ShardGetService getService()
           
 GetStats getStats()
           
 boolean ignoreRecoveryAttempt()
          Returns true if this shard can ignore a recovery attempt made to it (since the already doing/done it)
 ParsedDocument index(Engine.Index index)
           
 ShardIndexingService indexingService()
           
 IndexingStats indexingStats(String... types)
           
 MergeSchedulerProvider mergeScheduler()
           
 MergeStats mergeStats()
           
 void optimize(Engine.Optimize optimize)
           
 RecoveryStatus peerRecoveryStatus()
          The peer recovery status if this shard recovered from a peer shard.
 void performRecoveryFinalization(boolean withFlush)
           
 void performRecoveryFinalization(boolean withFlush, RecoveryStatus peerRecoveryStatus)
           
 void performRecoveryOperation(Translog.Operation operation)
           
 void performRecoveryPrepareForTranslog()
          After the store has been recovered, we need to start the engine in order to apply operations
 Engine.Create prepareCreate(SourceToParse source)
           
 Engine.Delete prepareDelete(String type, String id, long version)
           
 Engine.DeleteByQuery prepareDeleteByQuery(BytesReference querySource, String[] filteringAliases, String... types)
           
 Engine.Index prepareIndex(SourceToParse source)
           
 void readAllowed()
           
 void recover(Engine.RecoveryHandler recoveryHandler)
           
 IndexShardState recovering(String reason)
          Marks the shard as recovering, fails with exception is recovering is not allowed to be set.
 void refresh(Engine.Refresh refresh)
           
 RefreshStats refreshStats()
           
 InternalIndexShard relocated(String reason)
           
 ShardRouting routingEntry()
           
 InternalIndexShard routingEntry(ShardRouting shardRouting)
           
 Engine.Searcher searcher()
           
 ShardSearchService searchService()
           
 SearchStats searchStats(String... groups)
           
<T> T
snapshot(Engine.SnapshotHandler<T> snapshotHandler)
           
 InternalIndexShard start(String reason)
           
 IndexShardState state()
           
 Store store()
           
 StoreStats storeStats()
           
 Translog translog()
           
 ShardIndexWarmerService warmerService()
           
 WarmerStats warmerStats()
           
 
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,
                                 IndexSettingsService indexSettingsService,
                                 IndicesLifecycle indicesLifecycle,
                                 Store store,
                                 Engine engine,
                                 MergeSchedulerProvider mergeScheduler,
                                 Translog translog,
                                 ThreadPool threadPool,
                                 MapperService mapperService,
                                 IndexQueryParserService queryParserService,
                                 IndexCache indexCache,
                                 IndexAliasesService indexAliasesService,
                                 ShardIndexingService indexingService,
                                 ShardGetService getService,
                                 ShardSearchService searchService,
                                 ShardIndexWarmerService shardWarmerService)
Method Detail

mergeScheduler

public MergeSchedulerProvider mergeScheduler()

store

public Store store()

engine

public Engine engine()

translog

public Translog translog()

indexingService

public ShardIndexingService indexingService()
Specified by:
indexingService in interface IndexShard

getService

public ShardGetService getService()
Specified by:
getService in interface IndexShard

searchService

public ShardSearchService searchService()
Specified by:
searchService in interface IndexShard

warmerService

public ShardIndexWarmerService warmerService()
Specified by:
warmerService in interface IndexShard

routingEntry

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

routingEntry

public InternalIndexShard routingEntry(ShardRouting shardRouting)

recovering

public IndexShardState recovering(String reason)
                           throws IndexShardStartedException,
                                  IndexShardRelocatedException,
                                  IndexShardRecoveringException,
                                  IndexShardClosedException
Marks the shard as recovering, fails with exception is recovering is not allowed to be set.

Throws:
IndexShardStartedException
IndexShardRelocatedException
IndexShardRecoveringException
IndexShardClosedException

relocated

public InternalIndexShard relocated(String reason)
                             throws IndexShardNotStartedException
Throws:
IndexShardNotStartedException

start

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

state

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

prepareCreate

public Engine.Create prepareCreate(SourceToParse source)
                            throws ElasticSearchException
Specified by:
prepareCreate in interface IndexShard
Throws:
ElasticSearchException

create

public ParsedDocument create(Engine.Create create)
                      throws ElasticSearchException
Specified by:
create in interface IndexShard
Throws:
ElasticSearchException

prepareIndex

public Engine.Index prepareIndex(SourceToParse source)
                          throws ElasticSearchException
Specified by:
prepareIndex in interface IndexShard
Throws:
ElasticSearchException

index

public ParsedDocument index(Engine.Index index)
                     throws ElasticSearchException
Specified by:
index in interface IndexShard
Throws:
ElasticSearchException

prepareDelete

public Engine.Delete prepareDelete(String type,
                                   String id,
                                   long version)
                            throws ElasticSearchException
Specified by:
prepareDelete in interface IndexShard
Throws:
ElasticSearchException

delete

public void delete(Engine.Delete delete)
            throws ElasticSearchException
Specified by:
delete in interface IndexShard
Throws:
ElasticSearchException

prepareDeleteByQuery

public Engine.DeleteByQuery prepareDeleteByQuery(BytesReference querySource,
                                                 @Nullable
                                                 String[] filteringAliases,
                                                 String... types)
                                          throws ElasticSearchException
Specified by:
prepareDeleteByQuery in interface IndexShard
Throws:
ElasticSearchException

deleteByQuery

public void deleteByQuery(Engine.DeleteByQuery deleteByQuery)
                   throws ElasticSearchException
Specified by:
deleteByQuery in interface IndexShard
Throws:
ElasticSearchException

get

public Engine.GetResult get(Engine.Get get)
                     throws ElasticSearchException
Specified by:
get in interface IndexShard
Throws:
ElasticSearchException

refresh

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

refreshStats

public RefreshStats refreshStats()
Specified by:
refreshStats in interface IndexShard

flushStats

public FlushStats flushStats()
Specified by:
flushStats in interface IndexShard

docStats

public DocsStats docStats()
Specified by:
docStats in interface IndexShard

indexingStats

public IndexingStats indexingStats(String... types)
Specified by:
indexingStats in interface IndexShard

searchStats

public SearchStats searchStats(String... groups)
Specified by:
searchStats in interface IndexShard

getStats

public GetStats getStats()
Specified by:
getStats in interface IndexShard

storeStats

public StoreStats storeStats()
Specified by:
storeStats in interface IndexShard

mergeStats

public MergeStats mergeStats()
Specified by:
mergeStats in interface IndexShard

warmerStats

public WarmerStats warmerStats()
Specified by:
warmerStats in interface IndexShard

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(String reason)

checkIndexTook

public long checkIndexTook()

performRecoveryPrepareForTranslog

public void performRecoveryPrepareForTranslog()
                                       throws ElasticSearchException
After the store has been recovered, we need to start the engine in order to apply operations

Throws:
ElasticSearchException

peerRecoveryStatus

public RecoveryStatus peerRecoveryStatus()
The peer recovery status if this shard recovered from a peer shard.


performRecoveryFinalization

public void performRecoveryFinalization(boolean withFlush,
                                        RecoveryStatus peerRecoveryStatus)
                                 throws ElasticSearchException
Throws:
ElasticSearchException

performRecoveryFinalization

public void performRecoveryFinalization(boolean withFlush)
                                 throws ElasticSearchException
Throws:
ElasticSearchException

performRecoveryOperation

public void performRecoveryOperation(Translog.Operation operation)
                              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


Copyright © 2009-2012. All Rights Reserved.