Package org.apache.solr.s3
Class S3BackupRepository
- java.lang.Object
-
- org.apache.solr.s3.S3BackupRepository
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,BackupRepository
,NamedListInitializedPlugin
public class S3BackupRepository extends Object implements BackupRepository
A concrete implementation ofBackupRepository
interface supporting backup/restore of Solr indexes to S3.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.core.backup.repository.BackupRepository
BackupRepository.PathType
-
-
Constructor Summary
Constructors Constructor Description S3BackupRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
copyIndexFileFrom(org.apache.lucene.store.Directory sourceDir, String sourceFileName, URI dest, String destFileName)
Copy an index file from specifiedsourceDir
to the destination repository (i.e.void
copyIndexFileTo(URI sourceDir, String sourceFileName, org.apache.lucene.store.Directory dest, String destFileName)
Copy an index file from specifiedsourceRepo
to the destination directory (i.e.void
createDirectory(URI path)
URI
createDirectoryURI(String location)
OutputStream
createOutput(URI path)
URI
createURI(String location)
void
delete(URI path, Collection<String> files, boolean ignoreNoSuchFileException)
void
deleteDirectory(URI path)
boolean
exists(URI path)
<T> T
getConfigProperty(String name)
BackupRepository.PathType
getPathType(URI path)
void
init(NamedList<?> args)
String[]
listAll(URI path)
This method returns all the entries (files and directories) in the specified directory.org.apache.lucene.store.IndexInput
openInput(URI path, String fileName, org.apache.lucene.store.IOContext ctx)
URI
resolve(URI baseUri, String... pathComponents)
URI
resolveDirectory(URI baseUri, String... pathComponents)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.core.backup.repository.BackupRepository
checksum, copyFileFrom, copyFileTo, copyIndexFileFrom, getBackupLocation, listAllOrEmpty
-
-
-
-
Method Detail
-
init
public void init(NamedList<?> args)
- Specified by:
init
in interfaceNamedListInitializedPlugin
-
getConfigProperty
public <T> T getConfigProperty(String name)
- Specified by:
getConfigProperty
in interfaceBackupRepository
-
createURI
public URI createURI(String location)
- Specified by:
createURI
in interfaceBackupRepository
-
createDirectoryURI
public URI createDirectoryURI(String location)
- Specified by:
createDirectoryURI
in interfaceBackupRepository
-
resolve
public URI resolve(URI baseUri, String... pathComponents)
- Specified by:
resolve
in interfaceBackupRepository
-
resolveDirectory
public URI resolveDirectory(URI baseUri, String... pathComponents)
- Specified by:
resolveDirectory
in interfaceBackupRepository
-
createDirectory
public void createDirectory(URI path) throws IOException
- Specified by:
createDirectory
in interfaceBackupRepository
- Throws:
IOException
-
deleteDirectory
public void deleteDirectory(URI path) throws IOException
- Specified by:
deleteDirectory
in interfaceBackupRepository
- Throws:
IOException
-
delete
public void delete(URI path, Collection<String> files, boolean ignoreNoSuchFileException) throws IOException
- Specified by:
delete
in interfaceBackupRepository
- Throws:
IOException
-
exists
public boolean exists(URI path) throws IOException
- Specified by:
exists
in interfaceBackupRepository
- Throws:
IOException
-
openInput
public org.apache.lucene.store.IndexInput openInput(URI path, String fileName, org.apache.lucene.store.IOContext ctx) throws IOException
- Specified by:
openInput
in interfaceBackupRepository
- Throws:
IOException
-
createOutput
public OutputStream createOutput(URI path) throws IOException
- Specified by:
createOutput
in interfaceBackupRepository
- Throws:
IOException
-
listAll
public String[] listAll(URI path) throws IOException
This method returns all the entries (files and directories) in the specified directory.- Specified by:
listAll
in interfaceBackupRepository
- Parameters:
path
- The directory path- Returns:
- an array of strings, one for each entry in the directory
- Throws:
IOException
-
getPathType
public BackupRepository.PathType getPathType(URI path) throws IOException
- Specified by:
getPathType
in interfaceBackupRepository
- Throws:
IOException
-
copyIndexFileFrom
public void copyIndexFileFrom(org.apache.lucene.store.Directory sourceDir, String sourceFileName, URI dest, String destFileName) throws IOException
Copy an index file from specifiedsourceDir
to the destination repository (i.e. backup).- Specified by:
copyIndexFileFrom
in interfaceBackupRepository
- Parameters:
sourceDir
- The source directory hosting the file to be copied.sourceFileName
- The name of the file to be copieddest
- 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
-
copyIndexFileTo
public void copyIndexFileTo(URI sourceDir, String sourceFileName, org.apache.lucene.store.Directory dest, String destFileName) throws IOException
Copy an index file from specifiedsourceRepo
to the destination directory (i.e. restore).- Specified by:
copyIndexFileTo
in interfaceBackupRepository
- 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.
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-