Interface BackupRepository
- All Superinterfaces:
AutoCloseable,Closeable,NamedListInitializedPlugin
- All Known Implementing Classes:
AbstractBackupRepository,DelegatingBackupRepository,LocalFileSystemRepository
This interface defines the functionality required to backup/restore Solr indexes to an arbitrary
storage system.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThis enumeration defines the type of a given path. -
Method Summary
Modifier and TypeMethodDescriptiondefault ChecksumGet checksum offileNameatdir.default voidcopyFileFrom(org.apache.lucene.store.Directory sourceDir, String fileName, URI dest) Copy a file from specifiedsourceDirto the destination repository (i.e.default voidcopyFileNoChecksum(org.apache.lucene.store.Directory sourceDir, String sourceFileName, org.apache.lucene.store.Directory destDir, String destFileName) Copy a file from a sourceDirectoryto a destinationDirectorywithout verifying the checksum.default voidcopyFileTo(URI sourceRepo, String fileName, org.apache.lucene.store.Directory dest) Copy a file from specifiedsourceRepoto the destination directory (i.e.default voidcopyIndexFileFrom(org.apache.lucene.store.Directory sourceDir, String sourceFileName, URI destDir, String destFileName) Copy an index file from specifiedsourceDirto the destination repository (i.e.default voidcopyIndexFileFrom(org.apache.lucene.store.Directory sourceDir, String sourceFileName, org.apache.lucene.store.Directory destDir, String destFileName) Copies an index file from a specifiedDirectoryto a destinationDirectory.default voidcopyIndexFileTo(URI sourceRepo, String sourceFileName, org.apache.lucene.store.Directory dest, String destFileName) Copy an index file from specifiedsourceRepoto the destination directory (i.e.voidcreateDirectory(URI path) This method creates a directory at the specified path.default URIcreateDirectoryURI(String path) This method returns the directory URI representation for the specified path.createOutput(URI path) This method returns a OutputStream instance for the specifiedpathThis method returns the URI representation for the specified path.default voiddelete(URI path, Collection<String> files) DeletefilesatpathvoiddeleteDirectory(URI path) This method deletes a directory at the specified path.booleanThis method checks if the specified path exists in this repository.default StringgetBackupLocation(String override) This method returns the location where the backup should be stored (or restored from).<T> TgetConfigProperty(String name) This method returns the value of the specified configuration property.getPathType(URI path) This method returns the type of a specified pathString[]This method returns all the entries (files and directories) in the specified directory.default String[]listAllOrEmpty(URI path) List all files or directories directly underpath.org.apache.lucene.store.IndexInputThis method returns a Lucene input stream reading an existing file.This method resolves a URI using the specified path components (as method arguments).default URIresolveDirectory(URI baseUri, String... pathComponents) This method resolves a directory URI using the specified path components (as method arguments).Methods inherited from interface org.apache.solr.util.plugin.NamedListInitializedPlugin
init
-
Method Details
-
getBackupLocation
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
overrideis not null then return the same value Otherwise return the default configuration value for the CoreAdminParams.BACKUP_LOCATION parameter.
-
getConfigProperty
This method returns the value of the specified configuration property. -
createURI
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
-
createDirectoryURI
This method returns the directory 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, ensured to look like a directory.
-
resolve
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
-
resolveDirectory
This method resolves a directory 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, ensured to look like a directory
-
exists
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
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
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
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
This method creates a directory at the specified path. If the directory already exist, this will be a no-op.- Parameters:
path- The path where the directory needs to be created.- Throws:
IOException- in case of errors
-
deleteDirectory
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
default void copyFileFrom(org.apache.lucene.store.Directory sourceDir, String fileName, URI dest) throws IOException Copy a file from specifiedsourceDirto the destination repository (i.e. backup).- Parameters:
sourceDir- The source directory hosting the file to be copied.fileName- The name of the file to be copieddest- The destination backup location.- Throws:
IOException- in case of errors
-
copyFileTo
default void copyFileTo(URI sourceRepo, String fileName, org.apache.lucene.store.Directory dest) throws IOException Copy a file from specifiedsourceRepoto the destination directory (i.e. restore).- Parameters:
sourceRepo- The source URI hosting the file to be copied.fileName- The name of the file to be copieddest- The destination where the file should be copied.- Throws:
IOException- in case of errors.
-
listAllOrEmpty
List all files or directories directly underpath.- Returns:
- an empty array in case of IOException
-
copyIndexFileFrom
default void copyIndexFileFrom(org.apache.lucene.store.Directory sourceDir, String sourceFileName, org.apache.lucene.store.Directory destDir, String destFileName) throws IOException Copies an index file from a specifiedDirectoryto a destinationDirectory.- Parameters:
sourceDir- The source directory hosting the file to be copied.sourceFileName- The name of the file to be copieddestDir- The destination directory.- Throws:
org.apache.lucene.index.CorruptIndexException- in case checksum of the file does not match with precomputed checksum stored at the end of the fileIOException
-
delete
Deletefilesatpath- Throws:
IOException- Since:
- 9.3.0
-
checksum
default Checksum checksum(org.apache.lucene.store.Directory dir, String fileName) throws IOException Get checksum offileNameatdir. This method only be called on Lucene index files- Throws:
IOException- Since:
- 8.3.0
-
copyIndexFileFrom
default void copyIndexFileFrom(org.apache.lucene.store.Directory sourceDir, String sourceFileName, URI destDir, String destFileName) throws IOException Copy an index file from specifiedsourceDirto the destination repository (i.e. backup).- Parameters:
sourceDir- The source directory hosting the file to be copied.sourceFileName- The name of the file to be copieddestDir- The destination backup location.- Throws:
IOException- in case of errorsorg.apache.lucene.index.CorruptIndexException- in case checksum of the file does not match with precomputed checksum stored at the end of the file- Since:
- 8.3.0
-
copyIndexFileTo
default void copyIndexFileTo(URI sourceRepo, String sourceFileName, org.apache.lucene.store.Directory dest, String destFileName) throws IOException Copy an index file from specifiedsourceRepoto the destination directory (i.e. restore).- Parameters:
sourceRepo- The source URI hosting the file to be copied.dest- The destination where the file should be copied.- Throws:
IOException- in case of errors.- Since:
- 8.3.0
-
copyFileNoChecksum
default void copyFileNoChecksum(org.apache.lucene.store.Directory sourceDir, String sourceFileName, org.apache.lucene.store.Directory destDir, String destFileName) throws IOException Copy a file from a sourceDirectoryto a destinationDirectorywithout verifying the checksum.- Parameters:
sourceDir- The source directory hosting the file to be copied.sourceFileName- The name of the file to be copied.destDir- The destination directory to copy the file to.destFileName- The name of the copied file at destination.- Throws:
IOException
-