public class IndexRevision extends java.lang.Object implements Revision
Revision
of a single index files which comprises the list of files
that are part of the current IndexCommit
. To ensure the files are not
deleted by IndexWriter
for as long as this revision stays alive (i.e.
until release()
), the current commit point is snapshotted, using
SnapshotDeletionPolicy
(this means that the given writer's
config
should return
SnapshotDeletionPolicy
).
When this revision is released
, it releases the obtained
snapshot as well as calls IndexWriter.deleteUnusedFiles()
so that the
snapshotted files are deleted (if they are no longer needed).
Constructor and Description |
---|
IndexRevision(IndexWriter writer)
Constructor over the given
IndexWriter . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Revision o) |
int |
compareTo(java.lang.String version)
Compares the revision to the given version string.
|
java.util.Map<java.lang.String,java.util.List<RevisionFile>> |
getSourceFiles()
Returns the files that comprise this revision, as a mapping from a source
to a list of files.
|
java.lang.String |
getVersion()
Returns a string representation of the version of this revision.
|
java.io.InputStream |
open(java.lang.String source,
java.lang.String fileName)
Returns an
IndexInput for the given fileName and source. |
void |
release()
Called when this revision can be safely released, i.e.
|
static java.util.Map<java.lang.String,java.util.List<RevisionFile>> |
revisionFiles(IndexCommit commit)
Returns a singleton map of the revision files from the given
IndexCommit . |
static java.lang.String |
revisionVersion(IndexCommit commit)
Returns a String representation of a revision's version from the given
IndexCommit . |
java.lang.String |
toString() |
public IndexRevision(IndexWriter writer) throws java.io.IOException
IndexWriter
. Uses the last
IndexCommit
found in the Directory
managed by the given
writer.java.io.IOException
public static java.util.Map<java.lang.String,java.util.List<RevisionFile>> revisionFiles(IndexCommit commit) throws java.io.IOException
IndexCommit
.java.io.IOException
public static java.lang.String revisionVersion(IndexCommit commit)
IndexCommit
.public int compareTo(java.lang.String version)
Revision
Comparable.compareTo(Object)
.public int compareTo(Revision o)
compareTo
in interface java.lang.Comparable<Revision>
public java.lang.String getVersion()
Revision
Revision.compareTo(String)
as well as to
serialize/deserialize revision information. Therefore it must be self
descriptive as well as be able to identify one revision from another.getVersion
in interface Revision
public java.util.Map<java.lang.String,java.util.List<RevisionFile>> getSourceFiles()
Revision
getSourceFiles
in interface Revision
public java.io.InputStream open(java.lang.String source, java.lang.String fileName) throws java.io.IOException
Revision
IndexInput
for the given fileName and source. It is the
caller's respnsibility to close the IndexInput
when it has been
consumed.public void release() throws java.io.IOException
Revision
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.