Package org.apache.solr.gcs
Class GCSBackupRepository
- java.lang.Object
-
- org.apache.solr.gcs.GCSBackupRepository
-
- All Implemented Interfaces:
Closeable,AutoCloseable,BackupRepository,NamedListInitializedPlugin
public class GCSBackupRepository extends Object implements BackupRepository
BackupRepositoryimplementation that stores files in Google Cloud Storage ("GCS").
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.core.backup.repository.BackupRepository
BackupRepository.PathType
-
-
Field Summary
Fields Modifier and Type Field Description protected StringbucketNameprotected StringcredentialPathprotected intreadBufferSizeBytesprotected com.google.cloud.storage.Storagestorageprotected com.google.cloud.storage.StorageOptions.BuilderstorageOptionsBuilderprotected intwriteBufferSizeBytes
-
Constructor Summary
Constructors Constructor Description GCSBackupRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<com.google.cloud.storage.BlobId>allBlobsAtDir(URI path)voidclose()voidcopyIndexFileFrom(org.apache.lucene.store.Directory sourceDir, String sourceFileName, URI destDir, String destFileName)voidcopyIndexFileTo(URI sourceRepo, String sourceFileName, org.apache.lucene.store.Directory dest, String destFileName)voidcreateDirectory(URI path)URIcreateDirectoryURI(String location)OutputStreamcreateOutput(URI path)URIcreateURI(String location)voiddelete(URI path, Collection<String> files)voiddeleteDirectory(URI path)booleanexists(String path)booleanexists(URI path)<T> TgetConfigProperty(String name)protected com.google.cloud.storage.Storage.BlobWriteOption[]getDefaultBlobWriteOptions()BackupRepository.PathTypegetPathType(URI path)voidinit(org.apache.solr.common.util.NamedList<?> args)protected com.google.cloud.storage.StorageinitStorage()String[]listAll(URI path)org.apache.lucene.store.IndexInputopenInput(URI dirPath, String fileName, org.apache.lucene.store.IOContext ctx)URIresolve(URI baseUri, String... pathComponents)URIresolveDirectory(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, delete, getBackupLocation, listAllOrEmpty
-
-
-
-
Field Detail
-
storage
protected com.google.cloud.storage.Storage storage
-
bucketName
protected String bucketName
-
credentialPath
protected String credentialPath
-
writeBufferSizeBytes
protected int writeBufferSizeBytes
-
readBufferSizeBytes
protected int readBufferSizeBytes
-
storageOptionsBuilder
protected com.google.cloud.storage.StorageOptions.Builder storageOptionsBuilder
-
-
Method Detail
-
initStorage
protected com.google.cloud.storage.Storage initStorage()
-
init
public void init(org.apache.solr.common.util.NamedList<?> args)
- Specified by:
initin interfaceNamedListInitializedPlugin
-
getConfigProperty
public <T> T getConfigProperty(String name)
- Specified by:
getConfigPropertyin interfaceBackupRepository
-
createURI
public URI createURI(String location)
- Specified by:
createURIin interfaceBackupRepository
-
createDirectoryURI
public URI createDirectoryURI(String location)
- Specified by:
createDirectoryURIin interfaceBackupRepository
-
resolve
public URI resolve(URI baseUri, String... pathComponents)
- Specified by:
resolvein interfaceBackupRepository
-
resolveDirectory
public URI resolveDirectory(URI baseUri, String... pathComponents)
- Specified by:
resolveDirectoryin interfaceBackupRepository
-
exists
public boolean exists(URI path) throws IOException
- Specified by:
existsin interfaceBackupRepository- Throws:
IOException
-
exists
public boolean exists(String path) throws IOException
- Throws:
IOException
-
getPathType
public BackupRepository.PathType getPathType(URI path) throws IOException
- Specified by:
getPathTypein interfaceBackupRepository- Throws:
IOException
-
listAll
public String[] listAll(URI path) throws IOException
- Specified by:
listAllin interfaceBackupRepository- Throws:
IOException
-
openInput
public org.apache.lucene.store.IndexInput openInput(URI dirPath, String fileName, org.apache.lucene.store.IOContext ctx) throws IOException
- Specified by:
openInputin interfaceBackupRepository- Throws:
IOException
-
createOutput
public OutputStream createOutput(URI path) throws IOException
- Specified by:
createOutputin interfaceBackupRepository- Throws:
IOException
-
createDirectory
public void createDirectory(URI path) throws IOException
- Specified by:
createDirectoryin interfaceBackupRepository- Throws:
IOException
-
deleteDirectory
public void deleteDirectory(URI path) throws IOException
- Specified by:
deleteDirectoryin interfaceBackupRepository- Throws:
IOException
-
allBlobsAtDir
protected List<com.google.cloud.storage.BlobId> allBlobsAtDir(URI path) throws IOException
- Throws:
IOException
-
delete
public void delete(URI path, Collection<String> files)
- Specified by:
deletein interfaceBackupRepository
-
copyIndexFileFrom
public void copyIndexFileFrom(org.apache.lucene.store.Directory sourceDir, String sourceFileName, URI destDir, String destFileName) throws IOException- Specified by:
copyIndexFileFromin interfaceBackupRepository- Throws:
IOException
-
copyIndexFileTo
public void copyIndexFileTo(URI sourceRepo, String sourceFileName, org.apache.lucene.store.Directory dest, String destFileName) throws IOException
- Specified by:
copyIndexFileToin interfaceBackupRepository- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getDefaultBlobWriteOptions
protected com.google.cloud.storage.Storage.BlobWriteOption[] getDefaultBlobWriteOptions()
-
-