Interface BackupRepository
-
- All Superinterfaces:
AutoCloseable
,Closeable
,NamedListInitializedPlugin
- All Known Implementing Classes:
HdfsBackupRepository
,LocalFileSystemRepository
public interface BackupRepository extends NamedListInitializedPlugin, Closeable
This interface defines the functionality required to backup/restore Solr indexes to an arbitrary storage system.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
BackupRepository.PathType
This enumeration defines the type of a given path.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
copyFileFrom(org.apache.lucene.store.Directory sourceDir, String fileName, URI dest)
Copy a file from specifiedsourceDir
to the destination repository (i.e.void
copyFileTo(URI sourceRepo, String fileName, org.apache.lucene.store.Directory dest)
Copy a file from specifiedsourceRepo
to the destination directory (i.e.void
createDirectory(URI path)
This method creates a directory at the specified path.OutputStream
createOutput(URI path)
This method returns a OutputStream instance for the specifiedpath
URI
createURI(String path)
This method returns the URI representation for the specified 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 pathString[]
listAll(URI path)
This method returns all the entries (files and directories) in the specified directory.org.apache.lucene.store.IndexInput
openInput(URI dirPath, String fileName, org.apache.lucene.store.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).-
Methods inherited from interface org.apache.solr.util.plugin.NamedListInitializedPlugin
init
-
-
-
-
Method Detail
-
getBackupLocation
default String getBackupLocation(String override)
This method returns the location where the backup should be stored (or restored from).- Parameters:
override
- The location parameter supplied by the user.- Returns:
- If
override
is not null then return the same value Otherwise return the default configuration value for the CoreAdminParams.BACKUP_LOCATION parameter.
-
getConfigProperty
<T> T getConfigProperty(String name)
This method returns the value of the specified configuration property.
-
createURI
URI createURI(String path)
This method returns the URI representation for the specified path. Note - the specified path could be a fully qualified URI OR a relative path for a file-system.- Parameters:
path
- The path specified by the user.- Returns:
- the URI representation of the user supplied value
-
resolve
URI resolve(URI baseUri, String... pathComponents)
This method resolves a URI using the specified path components (as method arguments).- Parameters:
baseUri
- The base URI to use for creating the pathpathComponents
- The directory (or file-name) to be included in the URI.- Returns:
- A URI containing absolute path
-
exists
boolean exists(URI path) throws IOException
This method checks if the specified path exists in this repository.- Parameters:
path
- The path whose existence needs to be checked.- Returns:
- if the specified path exists in this repository.
- Throws:
IOException
- in case of errors
-
getPathType
BackupRepository.PathType getPathType(URI path) throws IOException
This method returns the type of a specified path- Parameters:
path
- The path whose type needs to be checked.- Returns:
- the BackupRepository.PathType for the specified path
- Throws:
IOException
- in case of errors
-
listAll
String[] listAll(URI path) throws IOException
This method returns all the entries (files and directories) in the specified directory.- Parameters:
path
- The directory path- Returns:
- an array of strings, one for each entry in the directory
- Throws:
IOException
- in case of errors
-
openInput
org.apache.lucene.store.IndexInput openInput(URI dirPath, String fileName, org.apache.lucene.store.IOContext ctx) throws IOException
This method returns a Lucene input stream reading an existing file.- Parameters:
dirPath
- The parent directory of the file to be readfileName
- The name of the file to be readctx
- the Lucene IO context- Returns:
- Lucene IndexInput reference
- Throws:
IOException
- in case of errors
-
createOutput
OutputStream createOutput(URI path) throws IOException
This method returns a OutputStream instance for the specifiedpath
- Parameters:
path
- The path for which OutputStream needs to be created- Returns:
- OutputStream instance for the specified
path
- Throws:
IOException
- in case of errors
-
createDirectory
void createDirectory(URI path) throws IOException
This method creates a directory at the specified path.- Parameters:
path
- The path where the directory needs to be created.- Throws:
IOException
- in case of errors
-
deleteDirectory
void deleteDirectory(URI path) throws IOException
This method deletes a directory at the specified path.- Parameters:
path
- The path referring to the directory to be deleted.- Throws:
IOException
- in case of errors
-
copyFileFrom
void copyFileFrom(org.apache.lucene.store.Directory sourceDir, String fileName, URI dest) throws IOException
Copy a file from specifiedsourceDir
to the destination repository (i.e. backup).- Parameters:
sourceDir
- The source directory hosting the file to be copied.fileName
- The name of the file to by copieddest
- The destination backup location.- Throws:
IOException
- in case of errors
-
copyFileTo
void copyFileTo(URI sourceRepo, String fileName, org.apache.lucene.store.Directory dest) throws IOException
Copy a file from specifiedsourceRepo
to the destination directory (i.e. restore).- Parameters:
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.- Throws:
IOException
- in case of errors.
-
-