public class IndicesService extends AbstractLifecycleComponent<IndicesService> implements Iterable<IndexService>
lifecycle
componentSettings, logger, settings
Constructor and Description |
---|
IndicesService(Settings settings,
IndicesLifecycle indicesLifecycle,
IndicesAnalysisService indicesAnalysisService,
Injector injector,
NodeEnvironment nodeEnv) |
Modifier and Type | Method and Description |
---|---|
void |
addPendingDelete(Index index,
Settings settings)
Adds a pending delete for the given index shard.
|
void |
addPendingDelete(ShardId shardId,
Settings settings)
Adds a pending delete for the given index shard.
|
boolean |
canDeleteIndexContents(Index index,
Settings indexSettings)
This method returns true if the current node is allowed to delete the
given index.
|
boolean |
canDeleteShardContent(ShardId shardId,
IndexMetaData metaData)
Returns
true iff the shards content for the given shard can be deleted. |
boolean |
changesAllowed()
Returns true if changes (adding / removing) indices, shards and so on are allowed.
|
IndexService |
createIndex(String sIndexName,
Settings settings,
String localNodeId) |
void |
deleteClosedIndex(String reason,
IndexMetaData metaData,
ClusterState clusterState) |
void |
deleteIndex(String index,
String reason)
Deletes the given index.
|
void |
deleteIndexStore(String reason,
IndexMetaData metaData,
ClusterState clusterState)
Deletes the index store trying to acquire all shards locks for this index.
|
void |
deleteShardStore(String reason,
ShardId shardId,
IndexMetaData metaData)
This method deletes the shard contents on disk for the given shard ID.
|
void |
deleteShardStore(String reason,
ShardLock lock,
Settings indexSettings)
Deletes the shard with an already acquired shard lock.
|
protected void |
doClose() |
protected void |
doStart() |
protected void |
doStop() |
boolean |
hasIndex(String index) |
IndexService |
indexService(String index)
Returns an IndexService for the specified index if exists otherwise returns
null . |
IndexService |
indexServiceSafe(String index)
Returns an IndexService for the specified index if exists otherwise a
IndexMissingException is thrown. |
IndicesLifecycle |
indicesLifecycle() |
Iterator<IndexService> |
iterator() |
void |
processPendingDeletes(Index index,
Settings indexSettings,
TimeValue timeout)
Processes all pending deletes for the given index.
|
void |
removeIndex(String index,
String reason)
Removes the given index from this service and releases all associated resources.
|
NodeIndicesStats |
stats(boolean includePrevious)
Returns the node stats indices stats.
|
NodeIndicesStats |
stats(boolean includePrevious,
CommonStatsFlags flags) |
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
nodeName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
@Inject public IndicesService(Settings settings, IndicesLifecycle indicesLifecycle, IndicesAnalysisService indicesAnalysisService, Injector injector, NodeEnvironment nodeEnv)
protected void doStart() throws ElasticsearchException
doStart
in class AbstractLifecycleComponent<IndicesService>
ElasticsearchException
protected void doStop() throws ElasticsearchException
doStop
in class AbstractLifecycleComponent<IndicesService>
ElasticsearchException
protected void doClose() throws ElasticsearchException
doClose
in class AbstractLifecycleComponent<IndicesService>
ElasticsearchException
public IndicesLifecycle indicesLifecycle()
public NodeIndicesStats stats(boolean includePrevious)
public NodeIndicesStats stats(boolean includePrevious, CommonStatsFlags flags)
public boolean changesAllowed()
public Iterator<IndexService> iterator()
iterator
in interface Iterable<IndexService>
public boolean hasIndex(String index)
@Nullable public IndexService indexService(String index)
null
.public IndexService indexServiceSafe(String index) throws IndexMissingException
IndexMissingException
is thrown.IndexMissingException
public IndexService createIndex(String sIndexName, @IndexSettings Settings settings, String localNodeId) throws ElasticsearchException
ElasticsearchException
public void removeIndex(String index, String reason) throws ElasticsearchException
index
- the index to removereason
- the high level reason causing this removalElasticsearchException
public void deleteIndex(String index, String reason) throws IOException
removeIndex(String, String)
but fires
different lifecycle events to ensure pending resources of this index are immediately removed.index
- the index to deletereason
- the high level reason causing this deleteIOException
public void deleteClosedIndex(String reason, IndexMetaData metaData, ClusterState clusterState)
public void deleteIndexStore(String reason, IndexMetaData metaData, ClusterState clusterState) throws IOException
IOException
public void deleteShardStore(String reason, ShardLock lock, Settings indexSettings) throws IOException
reason
- the reason for the shard deletionlock
- the lock of the shard to deleteindexSettings
- the shards index settings.IOException
- if an IOException occurspublic void deleteShardStore(String reason, ShardId shardId, IndexMetaData metaData) throws IOException
canDeleteShardContent(org.elasticsearch.index.shard.ShardId, org.elasticsearch.cluster.metadata.IndexMetaData)
of if the shards lock can not be acquired.reason
- the reason for the shard deletionshardId
- the shards ID to deletemetaData
- the shards index metadata. This is required to access the indexes settings etc.IOException
- if an IOException occurspublic boolean canDeleteIndexContents(Index index, Settings indexSettings)
index
- Index
to check whether deletion is allowedindexSettings
- Settings
for the given indexpublic boolean canDeleteShardContent(ShardId shardId, IndexMetaData metaData)
true
iff the shards content for the given shard can be deleted.
This method will return false
if:
shardId
- the shard to delete.metaData
- the shards index metadata. This is required to access the indexes settings etc.public void addPendingDelete(ShardId shardId, @IndexSettings Settings settings)
public void addPendingDelete(Index index, @IndexSettings Settings settings)
public void processPendingDeletes(Index index, @IndexSettings Settings indexSettings, TimeValue timeout) throws IOException
index
- the index to process the pending deletes fortimeout
- the timeout used for processing pending deletesIOException
Copyright © 2009–2015. All rights reserved.