public interface BackupRepository extends NamedListInitializedPlugin, Closeable
Modifier and Type | Interface and Description |
---|---|
static class |
BackupRepository.PathType
This enumeration defines the type of a given path.
|
Modifier and Type | Method and Description |
---|---|
default Checksum |
checksum(Directory dir,
String fileName)
Get checksum of
fileName at dir . |
default void |
copyFileFrom(Directory sourceDir,
String fileName,
URI dest)
Copy a file from specified
sourceDir to the destination repository (i.e. |
default void |
copyFileTo(URI sourceRepo,
String fileName,
Directory dest)
Copy a file from specified
sourceRepo to the destination directory (i.e. |
default void |
copyIndexFileFrom(Directory sourceDir,
String sourceFileName,
Directory destDir,
String destFileName) |
default void |
copyIndexFileFrom(Directory sourceDir,
String sourceFileName,
URI destDir,
String destFileName)
Copy an index file from specified
sourceDir to the destination repository (i.e. |
default void |
copyIndexFileTo(URI sourceRepo,
String sourceFileName,
Directory dest,
String destFileName)
Copy an index file from specified
sourceRepo to the destination directory (i.e. |
void |
createDirectory(URI path)
This method creates a directory at the specified path.
|
default URI |
createDirectoryURI(String path)
This method returns the directory URI representation for the specified path.
|
OutputStream |
createOutput(URI path)
This method returns a OutputStream instance for the specified
path |
URI |
createURI(String path)
This method returns the URI representation for the specified path.
|
default void |
delete(URI path,
Collection<String> files,
boolean ignoreNoSuchFileException)
Delete
files at path |
void |
deleteDirectory(URI path)
This method deletes a directory at the specified path.
|
boolean |
exists(URI path)
This method checks if the specified path exists in this repository.
|
default String |
getBackupLocation(String override)
This method returns the location where the backup should be stored (or restored from).
|
<T> T |
getConfigProperty(String name)
This method returns the value of the specified configuration property.
|
BackupRepository.PathType |
getPathType(URI path)
This method returns the type of a specified path
|
String[] |
listAll(URI path)
This method returns all the entries (files and directories) in the specified directory.
|
default String[] |
listAllOrEmpty(URI path)
List all files or directories directly under
path . |
IndexInput |
openInput(URI dirPath,
String fileName,
IOContext ctx)
This method returns a Lucene input stream reading an existing file.
|
URI |
resolve(URI baseUri,
String... pathComponents)
This method resolves a URI using the specified path components (as method arguments).
|
default URI |
resolveDirectory(URI baseUri,
String... pathComponents)
This method resolves a directory URI using the specified path components (as method arguments).
|
init
default String getBackupLocation(String override)
override
- The location parameter supplied by the user.override
is not null then return the same value
Otherwise return the default configuration value for the CoreAdminParams.BACKUP_LOCATION parameter.<T> T getConfigProperty(String name)
URI createURI(String path)
path
- The path specified by the user.default URI createDirectoryURI(String path)
path
- The path specified by the user.URI resolve(URI baseUri, String... pathComponents)
baseUri
- The base URI to use for creating the pathpathComponents
- The directory (or file-name) to be included in the URI.default URI resolveDirectory(URI baseUri, String... pathComponents)
baseUri
- The base URI to use for creating the pathpathComponents
- The directory (or file-name) to be included in the URI.boolean exists(URI path) throws IOException
path
- The path whose existence needs to be checked.IOException
- in case of errorsBackupRepository.PathType getPathType(URI path) throws IOException
path
- The path whose type needs to be checked.IOException
- in case of errorsString[] listAll(URI path) throws IOException
path
- The directory pathIOException
- in case of errorsIndexInput openInput(URI dirPath, String fileName, IOContext ctx) throws IOException
dirPath
- The parent directory of the file to be readfileName
- The name of the file to be readctx
- the Lucene IO contextIOException
- in case of errorsOutputStream createOutput(URI path) throws IOException
path
path
- The path for which OutputStream needs to be createdpath
IOException
- in case of errorsvoid createDirectory(URI path) throws IOException
path
- The path where the directory needs to be created.IOException
- in case of errorsvoid deleteDirectory(URI path) throws IOException
path
- The path referring to the directory to be deleted.IOException
- in case of errorsdefault void copyFileFrom(Directory sourceDir, String fileName, URI dest) throws IOException
sourceDir
to the destination repository (i.e. backup).sourceDir
- The source directory hosting the file to be copied.fileName
- The name of the file to by copieddest
- The destination backup location.IOException
- in case of errorsdefault void copyFileTo(URI sourceRepo, String fileName, Directory dest) throws IOException
sourceRepo
to the destination directory (i.e. restore).sourceRepo
- The source URI hosting the file to be copied.fileName
- The name of the file to by copieddest
- The destination where the file should be copied.IOException
- in case of errors.default String[] listAllOrEmpty(URI path)
path
.default void copyIndexFileFrom(Directory sourceDir, String sourceFileName, Directory destDir, String destFileName) throws IOException
IOException
default void delete(URI path, Collection<String> files, boolean ignoreNoSuchFileException) throws IOException
files
at path
IOException
default Checksum checksum(Directory dir, String fileName) throws IOException
fileName
at dir
.
This method only be called on Lucene index filesIOException
default void copyIndexFileFrom(Directory sourceDir, String sourceFileName, URI destDir, String destFileName) throws IOException
sourceDir
to the destination repository (i.e. backup).sourceDir
- The source directory hosting the file to be copied.sourceFileName
- The name of the file to by copieddestDir
- The destination backup location.IOException
- in case of errorsCorruptIndexException
- in case checksum of the file does not match with precomputed checksum stored at the end of the filedefault void copyIndexFileTo(URI sourceRepo, String sourceFileName, Directory dest, String destFileName) throws IOException
sourceRepo
to the destination directory (i.e. restore).sourceRepo
- The source URI hosting the file to be copied.dest
- The destination where the file should be copied.IOException
- in case of errors.Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.