Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.replicator
Class IndexRevision

    java.lang.Object
      org.apache.lucene.replicator.IndexRevision

All Implemented Interfaces:
  Comparable<Revision>, Revision

    public class IndexRevision

extends Object
implements Revision

A `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).

WARNING: This API is experimental and might change in incompatible ways in the next release.

Constructor Summary
`IndexRevision(IndexWriter writer)` Constructor over the given `IndexWriter`.

Method Summary
`int` | `compareTo(Revision o)`
`int` | `compareTo(String version)` Compares the revision to the given version string.
`Map<String,List<RevisionFile>>` | `getSourceFiles()` Returns the files that comprise this revision, as a mapping from a source to a list of files.
`String` | `getVersion()` Returns a string representation of the version of this revision.
`InputStream` | `open(String source, String fileName)` Returns an `IndexInput` for the given fileName and source.
`void` | `release()` Called when this revision can be safely released, i.e.
`static Map<String,List<RevisionFile>>` | `revisionFiles(IndexCommit commit)` Returns a singleton map of the revision files from the given `IndexCommit`.
`static String` | `revisionVersion(IndexCommit commit)` Returns a String representation of a revision's version from the given `IndexCommit`.
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### IndexRevision

    public IndexRevision(IndexWriter writer)
                  throws IOException

  Constructor over the given `IndexWriter`. Uses the last `IndexCommit` found in the `Directory` managed by the given writer.

  Throws:
    `IOException`

Method Detail

### revisionFiles

    public static Map<String,List<RevisionFile>> revisionFiles(IndexCommit commit)
                                                        throws IOException

  Returns a singleton map of the revision files from the given `IndexCommit`.

  Throws:
    `IOException`

### revisionVersion

    public static String revisionVersion(IndexCommit commit)

  Returns a String representation of a revision's version from the given `IndexCommit`.

### compareTo

    public int compareTo(String version)

  Description copied from interface: `Revision`
  Compares the revision to the given version string. Behaves like `Comparable.compareTo(Object)`.

  Specified by:
    `compareTo` in interface `Revision`

### compareTo

    public int compareTo(Revision o)

  Specified by:
    `compareTo` in interface `Comparable<Revision>`

### getVersion

    public String getVersion()

  Description copied from interface: `Revision`
  Returns a string representation of the version of this revision. The version is used by `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.

  Specified by:
    `getVersion` in interface `Revision`

### getSourceFiles

    public Map<String,List<RevisionFile>> getSourceFiles()

  Description copied from interface: `Revision`
  Returns the files that comprise this revision, as a mapping from a source to a list of files.

  Specified by:
    `getSourceFiles` in interface `Revision`

### open

    public InputStream open(String source,
                            String fileName)
                     throws IOException

  Description copied from interface: `Revision`
  Returns an `IndexInput` for the given fileName and source. It is the caller's respnsibility to close the `IndexInput` when it has been consumed.

  Specified by:
    `open` in interface `Revision`
  Throws:
    `IOException`

### release

    public void release()
                 throws IOException

  Description copied from interface: `Revision`
  Called when this revision can be safely released, i.e. where there are no more references to it.

  Specified by:
    `release` in interface `Revision`
  Throws:
    `IOException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.