Package org.apache.solr.gcs
Class GCSBackupRepository
- java.lang.Object
-
- org.apache.solr.core.backup.repository.AbstractBackupRepository
-
- org.apache.solr.gcs.GCSBackupRepository
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,BackupRepository
,NamedListInitializedPlugin
public class GCSBackupRepository extends AbstractBackupRepository
BackupRepository
implementation 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 String
bucketName
protected String
credentialPath
protected int
readBufferSizeBytes
protected com.google.cloud.storage.Storage
storage
protected com.google.cloud.storage.StorageOptions.Builder
storageOptionsBuilder
protected int
writeBufferSizeBytes
-
Fields inherited from class org.apache.solr.core.backup.repository.AbstractBackupRepository
config, PARAM_VERIFY_CHECKSUM, shouldVerifyChecksum
-
-
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)
void
close()
void
copyIndexFileFrom(org.apache.lucene.store.Directory sourceDir, String sourceFileName, URI destDir, String destFileName)
void
copyIndexFileTo(URI sourceRepo, String sourceFileName, org.apache.lucene.store.Directory dest, String destFileName)
void
createDirectory(URI path)
URI
createDirectoryURI(String location)
OutputStream
createOutput(URI path)
URI
createURI(String location)
void
delete(URI path, Collection<String> files)
void
deleteDirectory(URI path)
boolean
exists(String path)
boolean
exists(URI path)
<T> T
getConfigProperty(String name)
protected com.google.cloud.storage.Storage.BlobWriteOption[]
getDefaultBlobWriteOptions()
BackupRepository.PathType
getPathType(URI path)
void
init(org.apache.solr.common.util.NamedList<?> args)
protected com.google.cloud.storage.Storage
initStorage()
String[]
listAll(URI path)
org.apache.lucene.store.IndexInput
openInput(URI dirPath, String fileName, org.apache.lucene.store.IOContext ctx)
URI
resolve(URI baseUri, String... pathComponents)
URI
resolveDirectory(URI baseUri, String... pathComponents)
-
Methods inherited from class org.apache.solr.core.backup.repository.AbstractBackupRepository
copyIndexFileFrom, getBooleanConfig
-
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, copyFileNoChecksum, copyFileTo, 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:
init
in interfaceNamedListInitializedPlugin
- Overrides:
init
in classAbstractBackupRepository
-
getConfigProperty
public <T> T getConfigProperty(String name)
-
exists
public boolean exists(URI path) throws IOException
- Throws:
IOException
-
exists
public boolean exists(String path) throws IOException
- Throws:
IOException
-
getPathType
public BackupRepository.PathType getPathType(URI path) throws IOException
- Throws:
IOException
-
listAll
public String[] listAll(URI path) throws IOException
- Throws:
IOException
-
openInput
public org.apache.lucene.store.IndexInput openInput(URI dirPath, String fileName, org.apache.lucene.store.IOContext ctx) throws IOException
- Throws:
IOException
-
createOutput
public OutputStream createOutput(URI path) throws IOException
- Throws:
IOException
-
createDirectory
public void createDirectory(URI path) throws IOException
- Throws:
IOException
-
deleteDirectory
public void deleteDirectory(URI path) throws IOException
- 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)
-
copyIndexFileFrom
public void copyIndexFileFrom(org.apache.lucene.store.Directory sourceDir, String sourceFileName, URI destDir, String destFileName) throws IOException
- Throws:
IOException
-
copyIndexFileTo
public void copyIndexFileTo(URI sourceRepo, String sourceFileName, org.apache.lucene.store.Directory dest, String destFileName) throws IOException
- Throws:
IOException
-
close
public void close() throws IOException
- Throws:
IOException
-
getDefaultBlobWriteOptions
protected com.google.cloud.storage.Storage.BlobWriteOption[] getDefaultBlobWriteOptions()
-
-