public class SolrSnapshotMetaDataManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SolrSnapshotMetaDataManager.SnapshotMetaData
A class defining the meta-data for a specific snapshot.
|
Modifier and Type | Field and Description |
---|---|
protected Map<String,SolrSnapshotMetaDataManager.SnapshotMetaData> |
nameToDetailsMapping
Used to map snapshot name to snapshot meta-data.
|
static String |
SNAPSHOT_METADATA_DIR |
static String |
SNAPSHOTS_PREFIX
Prefix used for the save file.
|
Constructor and Description |
---|
SolrSnapshotMetaDataManager(SolrCore solrCore,
Directory dir)
A constructor.
|
SolrSnapshotMetaDataManager(SolrCore solrCore,
Directory dir,
IndexWriterConfig.OpenMode mode)
A constructor.
|
Modifier and Type | Method and Description |
---|---|
Optional<IndexCommit> |
getIndexCommitByName(String commitName)
This method returns the IndexCommit associated with the specified
commitName . |
Optional<SolrSnapshotMetaDataManager.SnapshotMetaData> |
getSnapshotMetaData(String name)
This method returns the snapshot meta-data for the specified name (if it exists).
|
Directory |
getSnapshotsDir() |
boolean |
isSnapshotted(long genNumber)
This method returns if snapshot is created for the specified generation number in
the *current* index directory.
|
boolean |
isSnapshotted(String indexDirPath,
long genNumber)
This method returns if snapshot is created for the specified generation number in
the specified index directory.
|
List<String> |
listSnapshots() |
Collection<SolrSnapshotMetaDataManager.SnapshotMetaData> |
listSnapshotsInIndexDir(String indexDirPath)
This method returns a list of snapshots created in a specified index directory.
|
Optional<SolrSnapshotMetaDataManager.SnapshotMetaData> |
release(String name)
This method deletes a previously created snapshot (if any).
|
void |
snapshot(String name,
String indexDirPath,
long gen)
This method creates a new snapshot meta-data entry.
|
public static final String SNAPSHOT_METADATA_DIR
public static final String SNAPSHOTS_PREFIX
protected final Map<String,SolrSnapshotMetaDataManager.SnapshotMetaData> nameToDetailsMapping
public SolrSnapshotMetaDataManager(SolrCore solrCore, Directory dir) throws IOException
dir
- The directory where the snapshot meta-data should be stored. Enables updating
the existing meta-data.IOException
- in case of errors.public SolrSnapshotMetaDataManager(SolrCore solrCore, Directory dir, IndexWriterConfig.OpenMode mode) throws IOException
dir
- The directory where the snapshot meta-data is stored.mode
- CREATE If previous meta-data should be erased.
APPEND If previous meta-data should be read and updated.
CREATE_OR_APPEND Creates a new meta-data structure if one does not exist
Updates the existing structure if one exists.IOException
- in case of errors.public Directory getSnapshotsDir()
public void snapshot(String name, String indexDirPath, long gen) throws IOException
name
- The name of the snapshot.indexDirPath
- The directory path where the index files are stored.gen
- The generation number for the IndexCommit being snapshotted.IOException
- in case of I/O errors.public Optional<SolrSnapshotMetaDataManager.SnapshotMetaData> release(String name) throws IOException
name
- The name of the snapshot to be deleted.IOException
- in case of I/O errorpublic boolean isSnapshotted(long genNumber)
genNumber
- The generation number for the IndexCommit to be checked.public boolean isSnapshotted(String indexDirPath, long genNumber)
genNumber
- The generation number for the IndexCommit to be checked.public Optional<SolrSnapshotMetaDataManager.SnapshotMetaData> getSnapshotMetaData(String name)
name
- The name of the snapshotpublic Collection<SolrSnapshotMetaDataManager.SnapshotMetaData> listSnapshotsInIndexDir(String indexDirPath)
indexDirPath
- The index directory path.public Optional<IndexCommit> getIndexCommitByName(String commitName) throws IOException
commitName
. A snapshot with specified commitName
must
be created before invoking this method.commitName
- The name of persisted commitIOException
- in case of I/O error.Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.