Skip to content

Commit ed8938c

Browse files
committed
removed sync table
1 parent c7ebf74 commit ed8938c

File tree

6 files changed

+22
-138
lines changed

6 files changed

+22
-138
lines changed

api/specs/storage/_locations.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from typing import Annotated
2+
3+
from fastapi import APIRouter, Depends
4+
from models_library.api_schemas_storage import FileLocation
5+
from servicelib.aiohttp import status
6+
from simcore_service_storage._meta import API_VTAG
7+
from simcore_service_storage.models import StorageQueryParamsBase
8+
9+
router = APIRouter(
10+
prefix=f"/{API_VTAG}",
11+
tags=["locations"],
12+
)
13+
14+
15+
# HANDLERS ---------------------------------------------------
16+
@router.get(
17+
"/locations", status_code=status.HTTP_200_OK, response_model=list[FileLocation]
18+
)
19+
async def list_storage_locations(
20+
_query: Annotated[StorageQueryParamsBase, Depends()],
21+
):
22+
...

api/specs/web-server/_storage.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
FileUploadSchema,
1616
LinkType,
1717
PresignedLink,
18-
TableSynchronisation,
1918
)
2019
from models_library.generics import Envelope
2120
from models_library.projects_nodes_io import LocationID
@@ -45,17 +44,6 @@ async def list_storage_locations():
4544
"""Returns the list of available storage locations"""
4645

4746

48-
@router.post(
49-
"/storage/locations/{location_id}:sync",
50-
response_model=Envelope[TableSynchronisation],
51-
summary="Manually triggers the synchronisation of the file meta data table in the database",
52-
)
53-
async def synchronise_meta_data_table(
54-
location_id: LocationID, dry_run: bool = False, fire_and_forget: bool = False
55-
):
56-
"""Returns an object containing added, changed and removed paths"""
57-
58-
5947
@router.get(
6048
"/storage/locations/{location_id}/datasets",
6149
response_model=Envelope[list[DatasetMetaData]],

services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -5743,42 +5743,6 @@ paths:
57435743
$ref: '#/components/schemas/DatasetMetaData'
57445744
type: array
57455745
title: Response List Storage Locations
5746-
/v0/storage/locations/{location_id}:sync:
5747-
post:
5748-
tags:
5749-
- storage
5750-
summary: Manually triggers the synchronisation of the file meta data table in
5751-
the database
5752-
description: Returns an object containing added, changed and removed paths
5753-
operationId: synchronise_meta_data_table
5754-
parameters:
5755-
- name: location_id
5756-
in: path
5757-
required: true
5758-
schema:
5759-
type: integer
5760-
title: Location Id
5761-
- name: dry_run
5762-
in: query
5763-
required: false
5764-
schema:
5765-
type: boolean
5766-
default: false
5767-
title: Dry Run
5768-
- name: fire_and_forget
5769-
in: query
5770-
required: false
5771-
schema:
5772-
type: boolean
5773-
default: false
5774-
title: Fire And Forget
5775-
responses:
5776-
'200':
5777-
description: Successful Response
5778-
content:
5779-
application/json:
5780-
schema:
5781-
$ref: '#/components/schemas/Envelope_TableSynchronisation_'
57825746
/v0/storage/locations/{location_id}/datasets:
57835747
get:
57845748
tags:
@@ -8765,19 +8729,6 @@ components:
87658729
title: Error
87668730
type: object
87678731
title: Envelope[StatusDiagnosticsGet]
8768-
Envelope_TableSynchronisation_:
8769-
properties:
8770-
data:
8771-
anyOf:
8772-
- $ref: '#/components/schemas/TableSynchronisation'
8773-
- type: 'null'
8774-
error:
8775-
anyOf:
8776-
- {}
8777-
- type: 'null'
8778-
title: Error
8779-
type: object
8780-
title: Envelope[TableSynchronisation]
87818732
Envelope_TagGet_:
87828733
properties:
87838734
data:
@@ -14333,27 +14284,6 @@ components:
1433314284
additionalProperties: true
1433414285
type: object
1433514286
title: StudyUI
14336-
TableSynchronisation:
14337-
properties:
14338-
dry_run:
14339-
anyOf:
14340-
- type: boolean
14341-
- type: 'null'
14342-
title: Dry Run
14343-
fire_and_forget:
14344-
anyOf:
14345-
- type: boolean
14346-
- type: 'null'
14347-
title: Fire And Forget
14348-
removed:
14349-
items:
14350-
type: string
14351-
type: array
14352-
title: Removed
14353-
type: object
14354-
required:
14355-
- removed
14356-
title: TableSynchronisation
1435714287
TagAccessRights:
1435814288
properties:
1435914289
read:

services/web/server/src/simcore_service_webserver/storage/_handlers.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -339,25 +339,3 @@ class _PathParams(BaseModel):
339339

340340
payload, status = await _forward_request_to_storage(request, "DELETE", body=None)
341341
return create_data_response(payload, status=status)
342-
343-
344-
@routes.post(
345-
_path_prefix + "/{location_id}:sync",
346-
name="synchronise_meta_data_table",
347-
)
348-
@login_required
349-
@permission_required("storage.files.sync")
350-
async def synchronise_meta_data_table(request: web.Request) -> web.Response:
351-
class _PathParams(BaseModel):
352-
location_id: LocationID
353-
354-
parse_request_path_parameters_as(_PathParams, request)
355-
356-
class _QueryParams(BaseModel):
357-
dry_run: bool = False
358-
fire_and_forget: bool = False
359-
360-
parse_request_query_parameters_as(_QueryParams, request)
361-
362-
payload, status = await _forward_request_to_storage(request, "POST", body=None)
363-
return create_data_response(payload, status=status)

services/web/server/src/simcore_service_webserver/storage/schemas.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from enum import Enum
22
from typing import Any, TypeAlias
33

4-
from models_library.api_schemas_storage import TableSynchronisation
54
from pydantic import BaseModel, ConfigDict, Field, RootModel
65

76
# NOTE: storage generates URLs that contain double encoded
@@ -79,11 +78,6 @@ class FileLocationEnveloped(BaseModel):
7978
error: Any | None = None
8079

8180

82-
class TableSynchronisationEnveloped(BaseModel):
83-
data: TableSynchronisation
84-
error: Any
85-
86-
8781
class FileUploadEnveloped(BaseModel):
8882
data: FileUploadSchema
8983
error: Any

services/web/server/tests/unit/with_dbs/01/test_storage.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@ async def _get_datasets_meta(request: web.Request):
136136

137137
app = create_safe_application()
138138
app.router.add_get(f"/{storage_api_version}/locations", _get_locs)
139-
app.router.add_post(
140-
f"/{storage_api_version}/locations/0:sync", _post_sync_meta_data
141-
)
142139
app.router.add_get(
143140
f"/{storage_api_version}/locations/0/files/{{file_id}}/metadata", _get_filemeta
144141
)
@@ -181,31 +178,6 @@ async def test_list_storage_locations(
181178
assert data[0]["user_id"] == logged_user["id"]
182179

183180

184-
@pytest.mark.parametrize(
185-
"user_role,expected",
186-
[
187-
(UserRole.ANONYMOUS, status.HTTP_401_UNAUTHORIZED),
188-
(UserRole.GUEST, status.HTTP_403_FORBIDDEN),
189-
(UserRole.USER, status.HTTP_403_FORBIDDEN),
190-
(UserRole.TESTER, status.HTTP_403_FORBIDDEN),
191-
(UserRole.ADMIN, status.HTTP_200_OK),
192-
],
193-
)
194-
async def test_sync_file_meta_table(
195-
client: TestClient, storage_server: TestServer, logged_user, expected
196-
):
197-
url = "/v0/storage/locations/0:sync"
198-
assert url.startswith(PREFIX)
199-
200-
resp = await client.post(url, params={"dry_run": "true"})
201-
data, error = await assert_status(resp, expected)
202-
203-
if not error:
204-
# the test of the functionality is already done in storage
205-
assert "removed" in data
206-
assert not data["removed"]
207-
208-
209181
@pytest.mark.parametrize(
210182
"user_role,expected",
211183
[

0 commit comments

Comments
 (0)