Skip to content

Commit 127ee4d

Browse files
committed
implement dsm
1 parent feb4cd2 commit 127ee4d

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

services/storage/src/simcore_service_storage/api/rest/_paths.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
)
1212
from models_library.generics import Envelope
1313
from models_library.users import UserID
14-
from pydantic import ByteSize
1514

1615
from ...dsm_factory import BaseDataManager
1716
from .dependencies.dsm_prodiver import get_data_manager
@@ -60,5 +59,7 @@ async def compute_path_total_size(
6059
path: Path,
6160
):
6261
return Envelope[PathTotalSizeCreate](
63-
data=PathTotalSizeCreate(path=path, size=ByteSize(238723))
62+
data=PathTotalSizeCreate(
63+
path=path, size=await dsm.compute_path_total_size(user_id, path=path)
64+
)
6465
)

services/storage/src/simcore_service_storage/datcore_dsm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ async def list_paths(
187187
1,
188188
)
189189

190+
async def compute_path_total_size(self, user_id: UserID, *, path: Path) -> ByteSize:
191+
"""returns the total size of the path"""
192+
raise NotImplementedError
193+
190194
async def list_files(
191195
self,
192196
user_id: UserID,

services/storage/src/simcore_service_storage/dsm_factory.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ async def list_paths(
8080
) -> tuple[list[PathMetaData], GenericCursor | None, TotalNumber | None]:
8181
"""returns a page of the file meta data a user has access to"""
8282

83+
@abstractmethod
84+
async def compute_path_total_size(self, user_id: UserID, *, path: Path) -> ByteSize:
85+
"""returns the total size of the path"""
86+
8387
@abstractmethod
8488
async def get_file(self, user_id: UserID, file_id: StorageFileID) -> FileMetaData:
8589
"""returns the file meta data of file_id if user_id has the rights to"""

services/storage/src/simcore_service_storage/simcore_s3_dsm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ async def list_paths(
251251

252252
return paths_metadata, next_cursor, total
253253

254+
async def compute_path_total_size(self, user_id: UserID, *, path: Path) -> ByteSize:
255+
"""returns the total size of the path"""
256+
return 0
257+
254258
async def list_files(
255259
self,
256260
user_id: UserID,

0 commit comments

Comments
 (0)