Package org.apache.lucene.index
Class SnapshotDeletionPolicy.SnapshotCommitPoint
- java.lang.Object
-
- org.apache.lucene.index.IndexCommit
-
- org.apache.lucene.index.SnapshotDeletionPolicy.SnapshotCommitPoint
-
- All Implemented Interfaces:
Comparable<IndexCommit>
- Enclosing class:
- SnapshotDeletionPolicy
protected class SnapshotDeletionPolicy.SnapshotCommitPoint extends IndexCommit
-
-
Field Summary
Fields Modifier and Type Field Description protected IndexCommit
cp
-
Constructor Summary
Constructors Modifier Constructor Description protected
SnapshotCommitPoint(IndexCommit cp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
Delete this commit point.Directory
getDirectory()
Returns theDirectory
for the index.Collection<String>
getFileNames()
Returns all index files referenced by this commit point.long
getGeneration()
Returns the generation (the _N in segments_N) for this IndexCommitint
getSegmentCount()
Returns number of segments referenced by this commit.String
getSegmentsFileName()
Get the segments file (segments_N
) associated with this commit point.Map<String,String>
getUserData()
Returns userData, previously passed toIndexWriter.commit(Map)
for this commit.long
getVersion()
Returns the version for this IndexCommit.boolean
isDeleted()
protected boolean
shouldDelete(String segmentsFileName)
Returns true if this segment can be deleted.String
toString()
-
Methods inherited from class org.apache.lucene.index.IndexCommit
compareTo, equals, getTimestamp, hashCode
-
-
-
-
Field Detail
-
cp
protected IndexCommit cp
-
-
Constructor Detail
-
SnapshotCommitPoint
protected SnapshotCommitPoint(IndexCommit cp)
-
-
Method Detail
-
shouldDelete
protected boolean shouldDelete(String segmentsFileName)
Returns true if this segment can be deleted. The default implementation returns false if this segment is currently held as snapshot.
-
delete
public void delete()
Description copied from class:IndexCommit
Delete this commit point. This only applies when using the commit point in the context of IndexWriter's IndexDeletionPolicy.Upon calling this, the writer is notified that this commit point should be deleted.
Decision that a commit-point should be deleted is taken by the
IndexDeletionPolicy
in effect and therefore this should only be called by itsonInit()
oronCommit()
methods.- Specified by:
delete
in classIndexCommit
-
getDirectory
public Directory getDirectory()
Description copied from class:IndexCommit
Returns theDirectory
for the index.- Specified by:
getDirectory
in classIndexCommit
-
getFileNames
public Collection<String> getFileNames() throws IOException
Description copied from class:IndexCommit
Returns all index files referenced by this commit point.- Specified by:
getFileNames
in classIndexCommit
- Throws:
IOException
-
getGeneration
public long getGeneration()
Description copied from class:IndexCommit
Returns the generation (the _N in segments_N) for this IndexCommit- Specified by:
getGeneration
in classIndexCommit
-
getSegmentsFileName
public String getSegmentsFileName()
Description copied from class:IndexCommit
Get the segments file (segments_N
) associated with this commit point.- Specified by:
getSegmentsFileName
in classIndexCommit
-
getUserData
public Map<String,String> getUserData() throws IOException
Description copied from class:IndexCommit
Returns userData, previously passed toIndexWriter.commit(Map)
for this commit. Map is String -> String.- Specified by:
getUserData
in classIndexCommit
- Throws:
IOException
-
getVersion
public long getVersion()
Description copied from class:IndexCommit
Returns the version for this IndexCommit. This is the same value thatIndexReader.getVersion()
would return if it were opened on this commit.- Specified by:
getVersion
in classIndexCommit
-
isDeleted
public boolean isDeleted()
- Specified by:
isDeleted
in classIndexCommit
-
getSegmentCount
public int getSegmentCount()
Description copied from class:IndexCommit
Returns number of segments referenced by this commit.- Specified by:
getSegmentCount
in classIndexCommit
-
-