org.apache.lucene.replicator

## Interface Revision

All Superinterfaces:
  Comparable<Revision>

All Known Implementing Classes:
  IndexAndTaxonomyRevision, IndexRevision

    public interface Revision
    extends Comparable<Revision>

A revision comprises lists of files that come from different sources and need to be replicated together to e.g. guarantee that all resources are in sync. In most cases an application will replicate a single index, and so the revision will contain files from a single source. However, some applications may require to treat a collection of indexes as a single entity so that the files from all sources are replicated together, to guarantee consistency between them. For example, an application which indexes facets will need to replicate both the search and taxonomy indexes together, to guarantee that they match at the client side.

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

### Method Summary

All Methods Instance Methods Abstract Methods
`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.

### Methods inherited from interface java.lang.Comparable

`compareTo`

### Method Detail

#### compareTo

    int compareTo(String version)

Compares the revision to the given version string. Behaves like `Comparable.compareTo(Object)`.

#### getVersion

    String getVersion()

Returns a string representation of the version of this revision. The version is used by `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.

#### getSourceFiles

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

Returns the files that comprise this revision, as a mapping from a source to a list of files.

#### open

    InputStream open(String source,
                     String fileName)
              throws IOException

Returns an `IndexInput` for the given fileName and source. It is the caller's responsibility to close the `IndexInput` when it has been consumed.

Throws:
  `IOException`

#### release

    void release()
          throws IOException

Called when this revision can be safely released, i.e. where there are no more references to it.

Throws:
  `IOException`