summaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/state.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/hydrilla/proxy/state.py')
-rw-r--r--src/hydrilla/proxy/state.py58
1 files changed, 52 insertions, 6 deletions
diff --git a/src/hydrilla/proxy/state.py b/src/hydrilla/proxy/state.py
index 559a546..4142f7f 100644
--- a/src/hydrilla/proxy/state.py
+++ b/src/hydrilla/proxy/state.py
@@ -259,6 +259,13 @@ class RepoIterationRef(Ref):
@dc.dataclass(frozen=True)
+class FileData:
+ mime_type: str
+ name: str
+ contents: bytes
+
+
+@dc.dataclass(frozen=True)
class MappingDisplayInfo(item_infos.CorrespondsToMappingDCMixin):
ref: 'MappingRef'
identifier: str
@@ -300,6 +307,10 @@ class MappingStore(Store[MappingRef]):
def get_display_infos(self) -> t.Sequence[MappingDisplayInfo]:
...
+ @abstractmethod
+ def get_by_identifier(self, identifier: str) -> MappingRef:
+ ...
+
@dc.dataclass(frozen=True, unsafe_hash=True) # type: ignore[misc]
class MappingVersionRef(Ref, item_infos.CorrespondsToMappingDCMixin):
@abstractmethod
@@ -323,6 +334,23 @@ class MappingVersionRef(Ref, item_infos.CorrespondsToMappingDCMixin):
...
@abstractmethod
+ def get_license_file(self, name: str) -> FileData:
+ ...
+
+ @abstractmethod
+ def get_upstream_license_file_url(self, name: str) -> str:
+ ...
+
+ @abstractmethod
+ def get_required_mapping(self, identifier: str) -> 'MappingVersionRef':
+ ...
+
+ @abstractmethod
+ def get_payload_resource(self, pattern: str, identifier: str) \
+ -> 'ResourceVersionRef':
+ ...
+
+ @abstractmethod
def get_item_display_info(self) -> RichMappingDisplayInfo:
...
@@ -359,6 +387,10 @@ class ResourceStore(Store[ResourceRef]):
def get_display_infos(self) -> t.Sequence[ResourceDisplayInfo]:
...
+ @abstractmethod
+ def get_by_identifier(self, identifier: str) -> ResourceRef:
+ ...
+
@dc.dataclass(frozen=True, unsafe_hash=True) # type: ignore[misc]
class ResourceVersionRef(Ref, item_infos.CorrespondsToResourceDCMixin):
@@ -371,6 +403,26 @@ class ResourceVersionRef(Ref, item_infos.CorrespondsToResourceDCMixin):
...
@abstractmethod
+ def get_license_file(self, name: str) -> FileData:
+ ...
+
+ @abstractmethod
+ def get_resource_file(self, name: str) -> FileData:
+ ...
+
+ @abstractmethod
+ def get_upstream_license_file_url(self, name: str) -> str:
+ ...
+
+ @abstractmethod
+ def get_upstream_resource_file_url(self, name: str) -> str:
+ ...
+
+ @abstractmethod
+ def get_dependency(self, identifier: str) -> ResourceVersionRef:
+ ...
+
+ @abstractmethod
def get_item_display_info(self) -> RichResourceDisplayInfo:
...
@@ -409,12 +461,6 @@ class PayloadDisplayInfo:
pattern: str
has_problems: bool
-@dc.dataclass(frozen=True)
-class FileData:
- type: str
- name: str
- contents: bytes
-
@dc.dataclass(frozen=True, unsafe_hash=True) # type: ignore[misc]
class PayloadRef(Ref):
"""...."""