aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/state.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-08-29 13:05:35 +0200
committerWojtek Kosior <koszko@koszko.org>2022-09-28 12:54:54 +0200
commit7fc6312d6df526b8eb49288aecf88d04668e7c45 (patch)
treebc9bda05270991892383839379c101515a440576 /src/hydrilla/proxy/state.py
parent367ea85057368047a50ae98a3510e0113eadd744 (diff)
downloadhaketilo-hydrilla-7fc6312d6df526b8eb49288aecf88d04668e7c45.tar.gz
haketilo-hydrilla-7fc6312d6df526b8eb49288aecf88d04668e7c45.zip
[proxy] make it possible to also view and install/uninstall libraries (resources) through the web UI
Diffstat (limited to 'src/hydrilla/proxy/state.py')
-rw-r--r--src/hydrilla/proxy/state.py51
1 files changed, 39 insertions, 12 deletions
diff --git a/src/hydrilla/proxy/state.py b/src/hydrilla/proxy/state.py
index 803e727..e8d8b15 100644
--- a/src/hydrilla/proxy/state.py
+++ b/src/hydrilla/proxy/state.py
@@ -227,10 +227,8 @@ class MappingStore(Store[MappingRef]):
def get_display_infos(self) -> t.Sequence[MappingDisplayInfo]:
...
-
@dc.dataclass(frozen=True, unsafe_hash=True) # type: ignore[misc]
class MappingVersionRef(Ref):
- """...."""
@abstractmethod
def install(self) -> None:
...
@@ -248,15 +246,49 @@ class MappingVersionStore(Store[MappingVersionRef]):
pass
+@dc.dataclass(frozen=True)
+class ResourceDisplayInfo:
+ ref: 'ResourceRef'
+ identifier: str
+
+@dc.dataclass(frozen=True)
+class ResourceVersionDisplayInfo:
+ ref: 'ResourceVersionRef'
+ info: item_infos.ResourceInfo
+ installed: InstalledStatus
+ active: ActiveStatus
+ is_orphan: bool
+ is_local: bool
+
@dc.dataclass(frozen=True, unsafe_hash=True) # type: ignore[misc]
class ResourceRef(Ref):
- """...."""
- pass
+ @abstractmethod
+ def get_version_display_infos(self) \
+ -> t.Sequence[ResourceVersionDisplayInfo]:
+ ...
+
+class ResourceStore(Store[ResourceRef]):
+ @abstractmethod
+ def get_display_infos(self) -> t.Sequence[ResourceDisplayInfo]:
+ ...
@dc.dataclass(frozen=True, unsafe_hash=True) # type: ignore[misc]
class ResourceVersionRef(Ref):
- """...."""
+ @abstractmethod
+ def install(self) -> None:
+ ...
+
+ @abstractmethod
+ def uninstall(self) -> t.Optional['ResourceVersionRef']:
+ ...
+
+ @abstractmethod
+ def get_all_version_display_infos(self) \
+ -> t.Sequence[ResourceVersionDisplayInfo]:
+ ...
+
+class ResourceVersionStore(Store[ResourceVersionRef]):
pass
@@ -360,23 +392,18 @@ class HaketiloState(ABC):
@abstractmethod
def mapping_store(self) -> MappingStore:
- """...."""
...
@abstractmethod
def mapping_version_store(self) -> MappingVersionStore:
- """...."""
...
@abstractmethod
- def get_resource(self, resource_id: str) -> ResourceRef:
- """...."""
+ def resource_store(self) -> ResourceStore:
...
@abstractmethod
- def get_resource_version(self, resource_version_id: str) \
- -> ResourceVersionRef:
- """...."""
+ def resource_version_store(self) -> ResourceVersionStore:
...
@abstractmethod