public interface SnowflakeStorageClient
| Modifier and Type | Method and Description |
|---|---|
void |
download(SFSession connection,
String command,
String localLocation,
String destFileName,
int parallelism,
String remoteStorageLocation,
String stageFilePath,
String stageRegion)
Download a file from remote storage.
|
int |
getEncryptionKeySize() |
int |
getMaxRetries() |
StorageObjectMetadata |
getObjectMetadata(String remoteStorageLocation,
String prefix)
Returns the metadata properties for a remote storage object
|
int |
getRetryBackoffMaxExponent()
Returns the max exponent for multiplying backoff with the power of 2, the value
of 4 will give us 16secs as the max number of time to sleep before retry
|
int |
getRetryBackoffMin() |
void |
handleStorageException(Exception ex,
int retryCount,
String operation,
SFSession connection,
String command)
Handles exceptions thrown by the remote storage provider
|
boolean |
isEncrypting() |
StorageObjectSummaryCollection |
listObjects(String remoteStorageLocation,
String prefix)
For a set of remote storage objects under a remote location and a given prefix/path
returns their properties wrapped in ObjectSummary objects
|
void |
renew(Map stageCredentials)
Re-creates the encapsulated storage client with a fresh access token
|
void |
shutdown()
shuts down the client
|
void |
upload(SFSession connection,
String command,
int parallelism,
boolean uploadFromStream,
String remoteStorageLocation,
File srcFile,
String destFileName,
InputStream inputStream,
FileBackedOutputStream fileBackedOutputStream,
StorageObjectMetadata meta,
String stageRegion)
Upload a file (-stream) to remote storage
|
int getMaxRetries()
int getRetryBackoffMaxExponent()
int getRetryBackoffMin()
boolean isEncrypting()
int getEncryptionKeySize()
void renew(Map stageCredentials) throws SnowflakeSQLException
stageCredentials - a Map (as returned by GS) which contains the new credential propertiesSnowflakeSQLException - if any error occursvoid shutdown()
StorageObjectSummaryCollection listObjects(String remoteStorageLocation, String prefix) throws StorageProviderException
remoteStorageLocation - location, i.e. bucket for S3prefix - the prefix to listStorageProviderException - if any error occursStorageObjectMetadata getObjectMetadata(String remoteStorageLocation, String prefix) throws StorageProviderException
remoteStorageLocation - location, i.e. bucket for S3prefix - the prefix/path of the object to retrieveStorageProviderException - if any error occursvoid download(SFSession connection, String command, String localLocation, String destFileName, int parallelism, String remoteStorageLocation, String stageFilePath, String stageRegion) throws SnowflakeSQLException
connection - connection objectcommand - command to download filelocalLocation - local file pathdestFileName - destination file nameparallelism - number of threads for parallel downloadingremoteStorageLocation - remote storage location, i.e. bucket for S3stageFilePath - stage file pathstageRegion - region name where the stage persistsSnowflakeSQLException - if any error occursvoid upload(SFSession connection, String command, int parallelism, boolean uploadFromStream, String remoteStorageLocation, File srcFile, String destFileName, InputStream inputStream, FileBackedOutputStream fileBackedOutputStream, StorageObjectMetadata meta, String stageRegion) throws SnowflakeSQLException
connection - connection objectcommand - upload commandparallelism - number of threads do parallel uploadinguploadFromStream - true if upload source is streamremoteStorageLocation - s3 bucket namesrcFile - source file if not uploading from a streamdestFileName - file name on remote storage after uploadinputStream - stream used for uploading if fileBackedOutputStream is nullfileBackedOutputStream - stream used for uploading if not nullmeta - object meta datastageRegion - region name where the stage persistsSnowflakeSQLException - if upload failed even after retryvoid handleStorageException(Exception ex, int retryCount, String operation, SFSession connection, String command) throws SnowflakeSQLException
ex - the exception to handleretryCount - current number of retries, incremented by the caller before each calloperation - string that indicates the function/operation that was taking place,
when the exception was raised, for example "upload"connection - the current SFSession object used by the clientcommand - the command attempted at the time of the exceptionSnowflakeSQLException - if any error occursCopyright © 2017. All rights reserved.