Class SnowflakeAzureClient

    • Method Detail

      • getRetryBackoffMaxExponent

        public int getRetryBackoffMaxExponent()
        Description copied from interface: SnowflakeStorageClient
        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
        Specified by:
        getRetryBackoffMaxExponent in interface SnowflakeStorageClient
        Returns:
        Returns the exponent
      • renew

        public void renew​(Map<?,​?> stageCredentials)
                   throws SnowflakeSQLException
        Re-creates the encapsulated storage client with a fresh access token
        Specified by:
        renew in interface SnowflakeStorageClient
        Parameters:
        stageCredentials - a Map (as returned by GS) which contains the new credential properties
        Throws:
        SnowflakeSQLException - failure to renew the client
      • download

        public void download​(SFSession session,
                             String command,
                             String localLocation,
                             String destFileName,
                             int parallelism,
                             String remoteStorageLocation,
                             String stageFilePath,
                             String stageRegion,
                             String presignedUrl)
                      throws SnowflakeSQLException
        Download a file from remote storage.
        Specified by:
        download in interface SnowflakeStorageClient
        Parameters:
        session - session object
        command - command to download file
        localLocation - local file path
        destFileName - destination file name
        parallelism - number of threads for parallel downloading
        remoteStorageLocation - remote storage location, i.e. bucket for S3
        stageFilePath - stage file path
        stageRegion - region name where the stage persists
        presignedUrl - Unused in Azure
        Throws:
        SnowflakeSQLException - download failure
      • downloadToStream

        public InputStream downloadToStream​(SFSession session,
                                            String command,
                                            int parallelism,
                                            String remoteStorageLocation,
                                            String stageFilePath,
                                            String stageRegion,
                                            String presignedUrl)
                                     throws SnowflakeSQLException
        Download a file from remote storage
        Specified by:
        downloadToStream in interface SnowflakeStorageClient
        Parameters:
        session - session object
        command - command to download file
        parallelism - number of threads for parallel downloading
        remoteStorageLocation - remote storage location, i.e. bucket for s3
        stageFilePath - stage file path
        stageRegion - region name where the stage persists
        presignedUrl - Unused in Azure
        Returns:
        input file stream
        Throws:
        SnowflakeSQLException - when download failure
      • upload

        public void upload​(SFSession session,
                           String command,
                           int parallelism,
                           boolean uploadFromStream,
                           String remoteStorageLocation,
                           File srcFile,
                           String destFileName,
                           InputStream inputStream,
                           FileBackedOutputStream fileBackedOutputStream,
                           StorageObjectMetadata meta,
                           String stageRegion,
                           String presignedUrl)
                    throws SnowflakeSQLException
        Upload a file/stream to remote storage
        Specified by:
        upload in interface SnowflakeStorageClient
        Parameters:
        session - session object
        command - upload command
        parallelism - number of threads for parallel uploading
        uploadFromStream - true if upload source is stream
        remoteStorageLocation - storage container name
        srcFile - source file if not uploading from a stream
        destFileName - file name on remote storage after upload
        inputStream - stream used for uploading if fileBackedOutputStream is null
        fileBackedOutputStream - stream used for uploading if not null
        meta - object meta data
        stageRegion - region name where the stage persists
        presignedUrl - Unused in Azure
        Throws:
        SnowflakeSQLException - if upload failed even after retry
      • handleStorageException

        public void handleStorageException​(Exception ex,
                                           int retryCount,
                                           String operation,
                                           SFSession session,
                                           String command)
                                    throws SnowflakeSQLException
        Handles exceptions thrown by Azure Storage
        Specified by:
        handleStorageException in interface SnowflakeStorageClient
        Parameters:
        ex - the exception to handle
        retryCount - current number of retries, incremented by the caller before each call
        operation - string that indicates the function/operation that was taking place, when the exception was raised, for example "upload"
        session - the current SFSession object used by the client
        command - the command attempted at the time of the exception
        Throws:
        SnowflakeSQLException - exceptions not handled
      • addEncryptionMetadata

        public void addEncryptionMetadata​(StorageObjectMetadata meta,
                                          MatDesc matDesc,
                                          byte[] ivData,
                                          byte[] encKeK,
                                          long contentLength)
        Adds encryption metadata to the StorageObjectMetadata object
        Specified by:
        addEncryptionMetadata in interface SnowflakeStorageClient
        Parameters:
        meta - the storage metadata object to add the encryption info to
        matDesc - the material descriptor
        ivData - the initialization vector
        encKeK - the key encryption key
        contentLength - the length of the encrypted content
      • addDigestMetadata

        public void addDigestMetadata​(StorageObjectMetadata meta,
                                      String digest)
        Adds digest metadata to the StorageObjectMetadata object
        Specified by:
        addDigestMetadata in interface SnowflakeStorageClient
        Parameters:
        meta - the storage metadata object to add the digest to
        digest - the digest metadata to add
      • addStreamingIngestMetadata

        public void addStreamingIngestMetadata​(StorageObjectMetadata meta,
                                               String clientName,
                                               String clientKey)
        Adds streaming ingest metadata to the StorageObjectMetadata object, used for streaming ingest per client billing calculation
        Specified by:
        addStreamingIngestMetadata in interface SnowflakeStorageClient
        Parameters:
        meta - the storage metadata object to add the digest to
        clientName - streaming ingest client name
        clientKey - streaming ingest client key, provided by Snowflake