Skip to content

Commit d5f79b3

Browse files
committed
removed sync table
1 parent 395e391 commit d5f79b3

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
@@ -5651,42 +5651,6 @@ paths:
56515651
$ref: '#/components/schemas/DatasetMetaData'
56525652
type: array
56535653
title: Response List Storage Locations
5654-
/v0/storage/locations/{location_id}:sync:
5655-
post:
5656-
tags:
5657-
- storage
5658-
summary: Manually triggers the synchronisation of the file meta data table in
5659-
the database
5660-
description: Returns an object containing added, changed and removed paths
5661-
operationId: synchronise_meta_data_table
5662-
parameters:
5663-
- name: location_id
5664-
in: path
5665-
required: true
5666-
schema:
5667-
type: integer
5668-
title: Location Id
5669-
- name: dry_run
5670-
in: query
5671-
required: false
5672-
schema:
5673-
type: boolean
5674-
default: false
5675-
title: Dry Run
5676-
- name: fire_and_forget
5677-
in: query
5678-
required: false
5679-
schema:
5680-
type: boolean
5681-
default: false
5682-
title: Fire And Forget
5683-
responses:
5684-
'200':
5685-
description: Successful Response
5686-
content:
5687-
application/json:
5688-
schema:
5689-
$ref: '#/components/schemas/Envelope_TableSynchronisation_'
56905654
/v0/storage/locations/{location_id}/datasets:
56915655
get:
56925656
tags:
@@ -8380,19 +8344,6 @@ components:
83808344
title: Error
83818345
type: object
83828346
title: Envelope[StatusDiagnosticsGet]
8383-
Envelope_TableSynchronisation_:
8384-
properties:
8385-
data:
8386-
anyOf:
8387-
- $ref: '#/components/schemas/TableSynchronisation'
8388-
- type: 'null'
8389-
error:
8390-
anyOf:
8391-
- {}
8392-
- type: 'null'
8393-
title: Error
8394-
type: object
8395-
title: Envelope[TableSynchronisation]
83968347
Envelope_TagGet_:
83978348
properties:
83988349
data:
@@ -13757,27 +13708,6 @@ components:
1375713708
additionalProperties: true
1375813709
type: object
1375913710
title: StudyUI
13760-
TableSynchronisation:
13761-
properties:
13762-
dry_run:
13763-
anyOf:
13764-
- type: boolean
13765-
- type: 'null'
13766-
title: Dry Run
13767-
fire_and_forget:
13768-
anyOf:
13769-
- type: boolean
13770-
- type: 'null'
13771-
title: Fire And Forget
13772-
removed:
13773-
items:
13774-
type: string
13775-
type: array
13776-
title: Removed
13777-
type: object
13778-
required:
13779-
- removed
13780-
title: TableSynchronisation
1378113711
TagAccessRights:
1378213712
properties:
1378313713
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)