Services

Other than the decorator definitions that can be found in Decorators. There are a number of useful functions that are used to implement services. These include:

get_service_inputs(path: str | None, service: Callable, __pre_resolved_types__: dict[TypeVar, HgTypeMetaData | Callable] = None, **kwargs)[source]

Extract the service inputs from a service interface. This is used when implementing a service with multiple interfaces, for example:

@service_impl(interfaces=(submit, receive, subscribe))
def impl(path: str):
    submissions: TSD[int, TS[int]] = get_service_inputs(path, submit).ts
set_service_output(path: str | None, service: Callable, out: OUT, __pre_resolved_types__=None, **kwargs)[source]

Extract the service inputs from a service interface. This is used when implementing a service with multiple interfaces, for example:

@service_impl(interfaces=(submit, receive, subscribe))
def impl(path: str):
    ...
    set_service_output(path, receive, items)