3030from yarl import URL
3131
3232from ..node_ports_common .client_session_manager import ClientSessionContextManager
33- from . import aws_s3_cli , exceptions , r_clone , storage_client
34- from ._filemanager import _abort_upload , _complete_upload , _resolve_location_id
33+ from . import aws_s3_cli , exceptions , filemanager_utils , r_clone , storage_client
3534from .file_io_utils import (
3635 LogRedirectCB ,
3736 UploadableFileObject ,
@@ -48,7 +47,7 @@ async def complete_file_upload(
4847 client_session : ClientSession | None = None ,
4948) -> ETag :
5049 async with ClientSessionContextManager (client_session ) as session :
51- e_tag : ETag | None = await _complete_upload (
50+ e_tag : ETag | None = await filemanager_utils . complete_upload (
5251 session = session ,
5352 upload_completion_link = upload_completion_link ,
5453 parts = uploaded_parts ,
@@ -75,7 +74,9 @@ async def get_download_link_from_s3(
7574 :raises exceptions.StorageServerIssue
7675 """
7776 async with ClientSessionContextManager (client_session ) as session :
78- store_id = await _resolve_location_id (session , user_id , store_name , store_id )
77+ store_id = await filemanager_utils .resolve_location_id (
78+ session , user_id , store_name , store_id
79+ )
7980 file_link = await storage_client .get_download_file_link (
8081 session = session ,
8182 file_id = s3_object ,
@@ -99,7 +100,9 @@ async def get_upload_links_from_s3(
99100 sha256_checksum : SHA256Str | None ,
100101) -> tuple [LocationID , FileUploadSchema ]:
101102 async with ClientSessionContextManager (client_session ) as session :
102- store_id = await _resolve_location_id (session , user_id , store_name , store_id )
103+ store_id = await filemanager_utils .resolve_location_id (
104+ session , user_id , store_name , store_id
105+ )
103106 file_links = await storage_client .get_upload_file_links (
104107 session = session ,
105108 file_id = s3_object ,
@@ -144,7 +147,9 @@ async def download_path_from_s3(
144147 )
145148
146149 async with ClientSessionContextManager (client_session ) as session :
147- store_id = await _resolve_location_id (session , user_id , store_name , store_id )
150+ store_id = await filemanager_utils .resolve_location_id (
151+ session , user_id , store_name , store_id
152+ )
148153 file_meta_data : FileMetaDataGet = await _get_file_meta_data (
149154 user_id = user_id ,
150155 s3_object = s3_object ,
@@ -259,7 +264,7 @@ async def abort_upload(
259264
260265 """
261266 async with ClientSessionContextManager (client_session ) as session :
262- await _abort_upload (
267+ await filemanager_utils . abort_upload (
263268 session = session ,
264269 abort_upload_link = abort_upload_link ,
265270 reraise_exceptions = True ,
@@ -425,13 +430,13 @@ async def _upload_path( # pylint: disable=too-many-arguments
425430 ) as exc :
426431 _logger .exception ("The upload failed with an unexpected error:" )
427432 if upload_links :
428- await _abort_upload (
433+ await filemanager_utils . abort_upload (
429434 session , upload_links .links .abort_upload , reraise_exceptions = False
430435 )
431436 raise exceptions .S3TransferError from exc
432437 except CancelledError :
433438 if upload_links :
434- await _abort_upload (
439+ await filemanager_utils . abort_upload (
435440 session , upload_links .links .abort_upload , reraise_exceptions = False
436441 )
437442 raise
@@ -485,7 +490,7 @@ async def _upload_to_s3(
485490 progress_bar = progress_bar ,
486491 )
487492 # complete the upload
488- e_tag = await _complete_upload (
493+ e_tag = await filemanager_utils . complete_upload (
489494 session ,
490495 upload_links .links .complete_upload ,
491496 uploaded_parts ,
0 commit comments