Class LocalFileSystemRepository
java.lang.Object
org.apache.solr.core.backup.repository.AbstractBackupRepository
org.apache.solr.core.backup.repository.LocalFileSystemRepository
- All Implemented Interfaces:
Closeable,AutoCloseable,BackupRepository,NamedListInitializedPlugin
A concrete implementation of BackupRepository interface supporting backup/restore of
Solr indexes to a local file-system. (Note - This can even be used for a shared file-system if it
is exposed via a local file-system interface e.g. NFS).
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.solr.core.backup.repository.BackupRepository
BackupRepository.PathType -
Field Summary
Fields inherited from class org.apache.solr.core.backup.repository.AbstractBackupRepository
config, PARAM_VERIFY_CHECKSUM, shouldVerifyChecksum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcopyIndexFileFrom(org.apache.lucene.store.Directory sourceDir, String sourceFileName, URI destDir, String destFileName) Copy an index file from specifiedsourceDirto the destination repository (i.e.voidcopyIndexFileTo(URI sourceDir, 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.createOutput(URI path) This method returns a OutputStream instance for the specifiedpathThis method returns the URI representation for the specified path.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.<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.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).Methods inherited from class org.apache.solr.core.backup.repository.AbstractBackupRepository
copyIndexFileFrom, getBooleanConfig, initMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.solr.core.backup.repository.BackupRepository
checksum, copyFileFrom, copyFileNoChecksum, copyFileTo, createDirectoryURI, getBackupLocation, listAllOrEmpty, resolveDirectory
-
Constructor Details
-
LocalFileSystemRepository
public LocalFileSystemRepository()
-
-
Method Details
-
getConfigProperty
Description copied from interface:BackupRepositoryThis method returns the value of the specified configuration property. -
createURI
Description copied from interface:BackupRepositoryThis 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:
location- The path specified by the user.- Returns:
- the URI representation of the user supplied value
-
resolve
Description copied from interface:BackupRepositoryThis 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
-
createDirectory
Description copied from interface:BackupRepositoryThis 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
Description copied from interface:BackupRepositoryThis 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
-
exists
Description copied from interface:BackupRepositoryThis 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
-
openInput
public org.apache.lucene.store.IndexInput openInput(URI dirPath, String fileName, org.apache.lucene.store.IOContext ctx) throws IOException Description copied from interface:BackupRepositoryThis 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
Description copied from interface:BackupRepositoryThis 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
-
listAll
Description copied from interface:BackupRepositoryThis method returns all the entries (files and directories) in the specified directory.- Parameters:
dirPath- The directory path- Returns:
- an array of strings, one for each entry in the directory
- Throws:
IOException- in case of errors
-
getPathType
Description copied from interface:BackupRepositoryThis 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
-
copyIndexFileFrom
public void copyIndexFileFrom(org.apache.lucene.store.Directory sourceDir, String sourceFileName, URI destDir, String destFileName) throws IOException Description copied from interface:BackupRepositoryCopy 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 errors
-
copyIndexFileTo
public void copyIndexFileTo(URI sourceDir, String sourceFileName, org.apache.lucene.store.Directory dest, String destFileName) throws IOException Description copied from interface:BackupRepositoryCopy an index file from specifiedsourceRepoto the destination directory (i.e. restore).- Parameters:
sourceDir- The source URI hosting the file to be copied.dest- The destination where the file should be copied.- Throws:
IOException- in case of errors.
-
delete
Description copied from interface:BackupRepositoryDeletefilesatpath- Throws:
IOException
-
close
- Throws:
IOException
-