evserver 0.2.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {evserver-0.2.0 → evserver-0.3.0}/PKG-INFO +2 -2
- {evserver-0.2.0 → evserver-0.3.0}/README.md +1 -1
- {evserver-0.2.0 → evserver-0.3.0}/pyproject.toml +1 -1
- {evserver-0.2.0 → evserver-0.3.0}/pyproject.toml.orig +1 -1
- {evserver-0.2.0 → evserver-0.3.0}/src/evserver/__init__.py +19 -19
- {evserver-0.2.0 → evserver-0.3.0}/src/evserver/stores.py +0 -0
- {evserver-0.2.0 → evserver-0.3.0}/src/evserver/types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: evserver
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Author: Wannes Vantorre
|
|
6
6
|
Author-email: Wannes Vantorre <vantorrewannes@gmail.com>
|
|
@@ -11,7 +11,7 @@ Requires-Dist: pydantic>=2.13.4
|
|
|
11
11
|
Requires-Python: >=3.14
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
|
|
14
|
-
#
|
|
14
|
+
# Easysnapshot
|
|
15
15
|
|
|
16
16
|
### Goals
|
|
17
17
|
|
|
@@ -5,7 +5,7 @@ from typing import Annotated, TypedDict
|
|
|
5
5
|
|
|
6
6
|
import dill
|
|
7
7
|
import uvicorn
|
|
8
|
-
from fastapi import Depends, FastAPI, HTTPException, Request
|
|
8
|
+
from fastapi import Depends, FastAPI, HTTPException, Request, Response
|
|
9
9
|
|
|
10
10
|
from evserver.stores import DirectoryStore
|
|
11
11
|
from evserver.types import (
|
|
@@ -36,12 +36,12 @@ class State(TypedDict):
|
|
|
36
36
|
@asynccontextmanager
|
|
37
37
|
async def lifespan(_: FastAPI) -> AsyncGenerator[State]:
|
|
38
38
|
root_path = Path("data")
|
|
39
|
-
user_store = DirectoryStore[UserId, User](root_path)
|
|
40
|
-
workspace_store = DirectoryStore[WorkspaceId, Workspace](root_path)
|
|
41
|
-
snapshot_store = DirectoryStore[SnapshotId, Snapshot](root_path)
|
|
42
|
-
manifest_store = DirectoryStore[ManifestId, Manifest](root_path)
|
|
43
|
-
reference_store = DirectoryStore[ReferenceId, Reference](root_path)
|
|
44
|
-
content_store = DirectoryStore[ContentId, Content](root_path)
|
|
39
|
+
user_store = DirectoryStore[UserId, User](root_path / "users")
|
|
40
|
+
workspace_store = DirectoryStore[WorkspaceId, Workspace](root_path / "workspaces")
|
|
41
|
+
snapshot_store = DirectoryStore[SnapshotId, Snapshot](root_path / "snapshots")
|
|
42
|
+
manifest_store = DirectoryStore[ManifestId, Manifest](root_path / "manifests")
|
|
43
|
+
reference_store = DirectoryStore[ReferenceId, Reference](root_path / "references")
|
|
44
|
+
content_store = DirectoryStore[ContentId, Content](root_path / "contents")
|
|
45
45
|
yield State(
|
|
46
46
|
user_store=user_store,
|
|
47
47
|
workspace_store=workspace_store,
|
|
@@ -108,9 +108,9 @@ async def head_user(user_id: UserId, user_store: UserStoreDependency) -> None:
|
|
|
108
108
|
@application.get(
|
|
109
109
|
"/user/{user_id}",
|
|
110
110
|
)
|
|
111
|
-
async def get_user(user_id: UserId, user_store: UserStoreDependency) ->
|
|
111
|
+
async def get_user(user_id: UserId, user_store: UserStoreDependency) -> Response:
|
|
112
112
|
if await user_store.contains(user_id):
|
|
113
|
-
return await user_store.get(user_id)
|
|
113
|
+
return Response(dill.dumps(await user_store.get(user_id)))
|
|
114
114
|
raise HTTPException(404)
|
|
115
115
|
|
|
116
116
|
|
|
@@ -147,9 +147,9 @@ async def head_workspace(
|
|
|
147
147
|
)
|
|
148
148
|
async def get_workspace(
|
|
149
149
|
workspace_id: WorkspaceId, workspace_store: WorkspaceStoreDependency
|
|
150
|
-
) ->
|
|
150
|
+
) -> Response:
|
|
151
151
|
if await workspace_store.contains(workspace_id):
|
|
152
|
-
return await workspace_store.get(workspace_id)
|
|
152
|
+
return Response(dill.dumps(await workspace_store.get(workspace_id)))
|
|
153
153
|
raise HTTPException(404)
|
|
154
154
|
|
|
155
155
|
|
|
@@ -190,9 +190,9 @@ async def head_snapshot(
|
|
|
190
190
|
)
|
|
191
191
|
async def get_snapshot(
|
|
192
192
|
snapshot_id: SnapshotId, snapshot_store: SnapshotDependency
|
|
193
|
-
) ->
|
|
193
|
+
) -> Response:
|
|
194
194
|
if await snapshot_store.contains(snapshot_id):
|
|
195
|
-
return await snapshot_store.get(snapshot_id)
|
|
195
|
+
return Response(dill.dumps(await snapshot_store.get(snapshot_id)))
|
|
196
196
|
raise HTTPException(404)
|
|
197
197
|
|
|
198
198
|
|
|
@@ -233,9 +233,9 @@ async def head_manifest(
|
|
|
233
233
|
)
|
|
234
234
|
async def get_manifest(
|
|
235
235
|
manifest_id: ManifestId, manifest_store: ManifestStoreDependency
|
|
236
|
-
) ->
|
|
236
|
+
) -> Response:
|
|
237
237
|
if await manifest_store.contains(manifest_id):
|
|
238
|
-
return await manifest_store.get(manifest_id)
|
|
238
|
+
return Response(dill.dumps(await manifest_store.get(manifest_id)))
|
|
239
239
|
raise HTTPException(404)
|
|
240
240
|
|
|
241
241
|
|
|
@@ -276,9 +276,9 @@ async def head_reference(
|
|
|
276
276
|
)
|
|
277
277
|
async def get_reference(
|
|
278
278
|
reference_id: ReferenceId, reference_store: ReferenceStoreDependency
|
|
279
|
-
) ->
|
|
279
|
+
) -> Response:
|
|
280
280
|
if await reference_store.contains(reference_id):
|
|
281
|
-
return await reference_store.get(reference_id)
|
|
281
|
+
return Response(dill.dumps(await reference_store.get(reference_id)))
|
|
282
282
|
raise HTTPException(404)
|
|
283
283
|
|
|
284
284
|
|
|
@@ -319,9 +319,9 @@ async def head_content(
|
|
|
319
319
|
)
|
|
320
320
|
async def get_content(
|
|
321
321
|
content_id: ContentId, content_store: ContentStoreDependency
|
|
322
|
-
) ->
|
|
322
|
+
) -> Response:
|
|
323
323
|
if await content_store.contains(content_id):
|
|
324
|
-
return await content_store.get(content_id)
|
|
324
|
+
return Response(dill.dumps(await content_store.get(content_id)))
|
|
325
325
|
raise HTTPException(404)
|
|
326
326
|
|
|
327
327
|
|
|
File without changes
|
|
File without changes
|