org.elasticsearch.index.deletionpolicy
Class SnapshotDeletionPolicy

java.lang.Object
  extended by org.elasticsearch.index.shard.AbstractIndexShardComponent
      extended by org.elasticsearch.index.deletionpolicy.SnapshotDeletionPolicy
All Implemented Interfaces:
org.apache.lucene.index.IndexDeletionPolicy, IndexShardComponent

public class SnapshotDeletionPolicy
extends AbstractIndexShardComponent
implements org.apache.lucene.index.IndexDeletionPolicy

Snapshot deletion policy allows to get snapshots of an index state (last commit or all commits) and if the deletion policy is used with all open index writers (JVM level) then the snapshot state will not be deleted until it will be released.


Field Summary
 
Fields inherited from class org.elasticsearch.index.shard.AbstractIndexShardComponent
componentSettings, indexSettings, logger, shardId
 
Constructor Summary
SnapshotDeletionPolicy(org.apache.lucene.index.IndexDeletionPolicy primary)
          Constructs a new snapshot deletion policy that wraps the provided deletion policy.
 
Method Summary
 void onCommit(List<? extends org.apache.lucene.index.IndexCommit> commits)
          Called by Lucene..
 void onInit(List<? extends org.apache.lucene.index.IndexCommit> commits)
          Called by Lucene.
 SnapshotIndexCommit snapshot()
          Returns a snapshot of the index (for the last commit point).
 SnapshotIndexCommits snapshots()
          Snapshots all the current commits in the index.
 
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
 

Constructor Detail

SnapshotDeletionPolicy

@Inject
public SnapshotDeletionPolicy(org.apache.lucene.index.IndexDeletionPolicy primary)
Constructs a new snapshot deletion policy that wraps the provided deletion policy.

Method Detail

onInit

public void onInit(List<? extends org.apache.lucene.index.IndexCommit> commits)
            throws IOException
Called by Lucene. Same as onCommit(java.util.List).

Specified by:
onInit in interface org.apache.lucene.index.IndexDeletionPolicy
Throws:
IOException

onCommit

public void onCommit(List<? extends org.apache.lucene.index.IndexCommit> commits)
              throws IOException
Called by Lucene.. Wraps the provided commits with SnapshotIndexCommit and delegates to the wrapped deletion policy.

Specified by:
onCommit in interface org.apache.lucene.index.IndexDeletionPolicy
Throws:
IOException

snapshots

public SnapshotIndexCommits snapshots()
                               throws IOException
Snapshots all the current commits in the index. Make sure to call SnapshotIndexCommits.release() to release it.

Throws:
IOException

snapshot

public SnapshotIndexCommit snapshot()
                             throws IOException
Returns a snapshot of the index (for the last commit point). Make sure to call SnapshotIndexCommit.release() in order to release it.

Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.