public final class IndexDeletionPolicyWrapper
extends org.apache.lucene.index.IndexDeletionPolicy
Provides features for looking up IndexCommit given a version. Allows reserving index commit points for certain amounts of time to support features such as index replication or snapshooting directly out of a live index directory.
NOTE: The clone()
method returns this in order to make
this IndexDeletionPolicy
instance trackable across IndexWriter
instantiations. This is correct because each core has its own
IndexDeletionPolicy
and never has more than one open IndexWriter
.
IndexDeletionPolicy
Constructor and Description |
---|
IndexDeletionPolicyWrapper(org.apache.lucene.index.IndexDeletionPolicy deletionPolicy) |
Modifier and Type | Method and Description |
---|---|
org.apache.lucene.index.IndexDeletionPolicy |
clone() |
org.apache.lucene.index.IndexCommit |
getCommitPoint(Long gen) |
Map<Long,org.apache.lucene.index.IndexCommit> |
getCommits()
Gets the commit points for the index.
|
static long |
getCommitTimestamp(org.apache.lucene.index.IndexCommit commit) |
org.apache.lucene.index.IndexCommit |
getLatestCommit()
Gets the most recent commit point
It is recommended to reserve a commit point for the duration of usage so that
it is not deleted by the underlying deletion policy
|
org.apache.lucene.index.IndexDeletionPolicy |
getWrappedDeletionPolicy() |
void |
onCommit(List<? extends org.apache.lucene.index.IndexCommit> list)
Internal use for Lucene... do not explicitly call.
|
void |
onInit(List<? extends org.apache.lucene.index.IndexCommit> list)
Internal use for Lucene... do not explicitly call.
|
void |
releaseCommitPoint(Long indexCommitGen)
Release a previously saved commit point
|
void |
saveCommitPoint(Long indexCommitGen)
Permanently prevent this commit point from being deleted.
|
void |
setReserveDuration(Long indexGen,
long reserveTime)
Set the duration for which commit point is to be reserved by the deletion policy.
|
public IndexDeletionPolicyWrapper(org.apache.lucene.index.IndexDeletionPolicy deletionPolicy)
public org.apache.lucene.index.IndexCommit getLatestCommit()
It is recommended to reserve a commit point for the duration of usage so that it is not deleted by the underlying deletion policy
public org.apache.lucene.index.IndexDeletionPolicy getWrappedDeletionPolicy()
public void setReserveDuration(Long indexGen, long reserveTime)
indexGen
- gen of the commit point to be reservedreserveTime
- time in milliseconds for which the commit point is to be reservedpublic void saveCommitPoint(Long indexCommitGen)
public void releaseCommitPoint(Long indexCommitGen)
public void onInit(List<? extends org.apache.lucene.index.IndexCommit> list) throws IOException
onInit
in class org.apache.lucene.index.IndexDeletionPolicy
IOException
public void onCommit(List<? extends org.apache.lucene.index.IndexCommit> list) throws IOException
onCommit
in class org.apache.lucene.index.IndexDeletionPolicy
IOException
public org.apache.lucene.index.IndexCommit getCommitPoint(Long gen)
gen
- the gen of the commit pointpublic Map<Long,org.apache.lucene.index.IndexCommit> getCommits()
public static long getCommitTimestamp(org.apache.lucene.index.IndexCommit commit) throws IOException
IOException
Copyright © 2000–2015 The Apache Software Foundation. All rights reserved.