Skip to content

Commit 00b1e7e

Browse files
authored
Saimon/direct io azure blob storage (#340)
1 parent 97ca5af commit 00b1e7e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

cterasdk/direct/lib.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
import asyncio
3+
import urllib.parse
34

45
from ..lib.retries import execute_with_retries
56
from .types import Metadata, Block
@@ -72,6 +73,10 @@ async def get_object(client, file_id, chunk):
7273
raise exception
7374

7475

76+
def is_azure_object_storage(chunk):
77+
return urllib.parse.urlparse(chunk.url).netloc.endswith('core.windows.net')
78+
79+
7580
async def decrypt_object(file_id, encrypted_object, encryption_key, chunk):
7681
"""
7782
Decrypt Encrypted Object.
@@ -83,7 +88,7 @@ async def decrypt_object(file_id, encrypted_object, encryption_key, chunk):
8388
:rtype: bytes
8489
"""
8590
try:
86-
return decrypt_block(encrypted_object, encryption_key)
91+
return decrypt_block(encrypted_object[16:] if is_azure_object_storage(chunk) else encrypted_object, encryption_key)
8792
except DirectIOError:
8893
logger.error('Failed to decrypt block.')
8994
raise DecryptBlockError(file_id, chunk)

docs/source/UserGuides/Miscellaneous/Changelog.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Changelog
22
=========
33

4+
2.20.30
5+
-------
6+
7+
Bug Fixes
8+
^^^^^^^^^
9+
* Update documentation to require :py:class:`cterasdk.core.types.UserAccount` in :py:class:`cterasdk.core.types.CloudFSFolderFindingHelper`
10+
* Support downloading files from Azure Blob Storage via CTERA Direct I/O.
11+
12+
413
2.20.28
514
-------
615

0 commit comments

Comments
 (0)