Providers¶
Define an alternate way to retrieve the query responses.
Interface¶
- class starmap_client.providers.StarmapProvider[source]¶
Define the interface for a local mappings provider.
- api = 'default'¶
The provider’s API level implementation.
- abstract query(params)[source]¶
Retrieve the mapping without using the server.
It relies in the local provider to retrieve the correct mapping according to the parameters.
- Parameters:
params (dict) – The request params to retrieve the mapping.
- Return type:
Optional
[TypeVar
(T
,QueryResponseContainer
,QueryResponseEntity
)]- Returns:
The requested mapping when found.
- abstract list_content()[source]¶
Return a list with all stored responses.
- Return type:
List
[TypeVar
(T
,QueryResponseContainer
,QueryResponseEntity
)]
Implementations¶
Memory Based¶
APIv2¶
- class starmap_client.providers.InMemoryMapProviderV2(container, *args, **kwargs)[source]¶
Provide in memory (RAM) QueryResponseContainer objects for APIv2.
- __init__(container, *args, **kwargs)[source]¶
Crete a new InMemoryMapProvider object.
- Parameters:
container (QueryResponseContainer) – QueryResponseContainer object to load into memory. It will be used by query to return the correct response based on name and workflow.
- query(params)[source]¶
Retrieve the mapping without using the server.
It relies in the local provider to retrieve the correct mappings according to the parameters.
- Parameters:
params (dict) – The request params to retrieve the mapping.
- Return type:
- Returns:
The requested container with mappings when found.