ruạṛ
a ���f�? � @ sx d dl Z d dlZd dlZd dlmZ d dlmZmZ G dd� de�ZG dd� de �Z G dd � d e �ZG d d� de �ZdS )� N)�Enum)�DownloadTerminated�#DownloadFailedIncorrectDownloadSizec @ s e Zd ZdZdZdZdS )� DownloadStater � � N)�__name__� __module__�__qualname__ZDOWNLOADING�PAUSED� TERMINATED� r r �`/usr/lib/python3.9/site-packages/oci/object_storage/transfer/internal/download/DownloadThread.pyr s r c @ s: e Zd ZdZddd�Zdd� Zdd � Zd d� Zdd � ZdS )�DownloadThreada The main class whose methods the threads use to perform the downloads and write to the stream. :param: DownloadManager download_manager: The download manger object :param: DownloadConfiguration download_configuration: The download configuration object :param: ObjectStorageClient object_storage_client: The object storage client :param: str namespace_name: The namespace name :param: str bucket_name: The bucket name :param: str object_name: The object name :param: bytestream stream: The stream to write into :param: int bytes_downloaded: The bytes downloaded so far before invoking this. :param: int object_size: The total size of the download in bytes, including the bytes already downloaded :param function progress_callback: (optional) This function is used to update the progress bar of the download operation. The arguments that it takes are (total_bytes_downloaded_so_far, total_bytes_to_download) :param any start_byte: (optional) The byte in the content of the object from which to start the download. The default value is 0 :param any end_byte: (optional) The byte in the content of the object from which to stop the download. The default value is the last byte of the object. Note: Both the start_byte and end_byte are included in the download. :param: bool did_some_parts_fail: True if some parts fail to download. :param: dict failed_parts: A dictionary filled with all the failed parts. Key: Failed part, Value: Error {(start_byte, end_byte) : error, (start_byte, end_byte): error,...} :param str version_id: (optional) VersionId used to identify a particular version of the object :param str if_match: (optional) The entity tag (ETag) to match with the ETag of an existing resource. If the specified ETag matches the ETag of the existing resource, GET and HEAD requests will return the resource and PUT and POST requests will upload the resource. :param str if_none_match: (optional) The entity tag (ETag) to avoid matching. Wildcards ('*') are not allowed. If the specified ETag does not match the ETag of the existing resource, the request returns the expected response. If the ETag matches the ETag of the existing resource, the request returns an HTTP 304 status without a response body. :param str opc_client_request_id: (optional) The client request ID for tracing. :param str opc_sse_customer_algorithm: (optional) The optional header that specifies "AES256" as the encryption algorithm. For more information, see `Using Your Own Keys for Server-Side Encryption`__. __ https://docs.cloud.oracle.com/Content/Object/Tasks/usingyourencryptionkeys.htm :param str opc_sse_customer_key: (optional) The optional header that specifies the base64-encoded 256-bit encryption key to use to encrypt or decrypt the data. For more information, see `Using Your Own Keys for Server-Side Encryption`__. __ https://docs.cloud.oracle.com/Content/Object/Tasks/usingyourencryptionkeys.htm :param str opc_sse_customer_key_sha256: (optional) The optional header that specifies the base64-encoded SHA256 hash of the encryption key. This value is used to check the integrity of the encryption key. For more information, see `Using Your Own Keys for Server-Side Encryption`__. __ https://docs.cloud.oracle.com/Content/Object/Tasks/usingyourencryptionkeys.htm :param str http_response_content_disposition: (optional) Specify this query parameter to override the value of the Content-Disposition response header in the GetObject response. :param str http_response_cache_control: (optional) Specify this query parameter to override the Cache-Control response header in the GetObject response. :param str http_response_content_type: (optional) Specify this query parameter to override the Content-Type response header in the GetObject response. :param str http_response_content_language: (optional) Specify this query parameter to override the Content-Language response header in the GetObject response. :param str http_response_content_encoding: (optional) Specify this query parameter to override the Content-Encoding response header in the GetObject response. :param str http_response_expires: (optional) Specify this query parameter to override the Expires response header in the GetObject response. :param obj retry_strategy: (optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level. This should be one of the strategies available in the :py:mod:`~oci.retry` module. This operation uses :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` as default if no retry strategy is provided. The specifics of the default retry strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/retries.html>`__. To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`. :param bool allow_control_chars: (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings Nr c s� || _ || _|| _|| _|| _|| _|| _| j�� | _|| _ | | _ | | _|| _|| _ d| _i | _g d�� � fdd�t�| �D �}|r�td|����| | _d S )NF)Zallow_control_chars�retry_strategyZ version_idZif_matchZ if_none_matchZopc_client_request_idZopc_sse_customer_algorithmZopc_sse_customer_keyZopc_sse_customer_key_sha256Z!http_response_content_dispositionZhttp_response_cache_controlZhttp_response_content_typeZhttp_response_content_languageZhttp_response_content_encodingZhttp_response_expiresc s g | ]}|� vr|�qS r r )�.0Z_key�Zexpected_kwargsr r � <listcomp>� � z+DownloadThread.__init__.<locals>.<listcomp>zget_object got unknown kwargs: )�download_manager�download_config�object_storage_client�namespace_name�bucket_name�object_name�stream�tell�stream_original_start�bytes_downloaded�object_size�progress_callback� start_byte�end_byte�did_some_parts_fail�failed_parts�sixZiterkeys� ValueError�header_args)�selfr r r r r r r r r r r! r"