Registration routes
2 unresolved threads
2 unresolved threads
Adding implementation routes
A Route
is bound to a queue
and operates on a particular data-type (such as STAC Item, Collection, paths, arbitrary JSON structures).
Backends
are also now generic according to its datatype and are now part of the route.
Each route also encapsulates the pre
, post
, and error
handlers.
Example configuration:
routes:
items:
path: registrar.route.stac.ItemRoute
queue: register
output_queue: next_queue
backends:
- path: registrar.backend.eoxserver.ItemBackend
kwargs:
instance_base_path: /some/dir
instance_name: name
handlers:
pre:
- path: some.pre.handler
post:
- path: some.post.handler
error:
- path: some.error.handler
collections:
path: registrar.route.stac.CollectionRoute
queue: register-collections
backends:
- path: registrar.backend.eoxserver.CollectionBackend
path:
path: registrar.route.path.PathRoute
queue: register-paths
backends:
- path: some.path.backend
sources: [...]
This is how a STAC Item route can be implemented:
import json
import pystac
class ItemRoute(Route[pystac.Item]):
"""A route implementation for STAC Items"""
def parse(self, raw: str) -> pystac.Item:
return pystac.Item.from_dict(json.loads(raw))
def get_source(
self, source_cfgs: List[SourceConfig], item: pystac.Item
) -> Optional[Source]:
return get_source(
source_cfgs, [asset.href for asset in item.assets.values()]
)
This is how the Backend
interface can be satisfied:
from pystac import Item
# ...
class MyItemBackend(Backend[Item]):
def exists(self, source: Optional[Source], item: Item) -> bool:
...
def register(self, source: Optional[Source], item: Item, replace: bool):
...
def deregister(self, source: Optional[Source], item: Item):
...
def deregister_identifier(self, identifier: str):
...
Edited by Fabian Schindler-Strauss
Merge request reports
Activity
- Resolved by Fabian Schindler-Strauss
95 95 def __repr__(self) -> str: 96 96 return f"<{self.__class__.__name__} instance_name ={self.instance_name}>" 97 97 98 def item_exists(self, source: Optional[Source], item: "Item") -> bool: added 15 commits
-
4ec3921a...fa3ec505 - 13 commits from branch
main
- 09ca05e4 - Merge branch 'main' into routes
- 72b44ea0 - Fixing command context instance
-
4ec3921a...fa3ec505 - 13 commits from branch
Consider: #19 (closed)
mentioned in issue #20 (moved)
added 2 commits
mentioned in commit 6cf3821f
Please register or sign in to reply