Module rest

Module rest 

Source
Expand description

REST-based asset information providers and polling mechanisms.

This module provides functionality for polling asset information from REST APIs. It defines a trait for asset information providers and a function for starting a polling loop that periodically fetches and stores asset information.

The module provides:

  • The AssetInfoProvider trait which defines the interface for REST-based asset info providers
  • The start_polling function which implements the polling loop mechanism

§Polling Strategy

The polling strategy follows these principles:

  1. Regular Intervals: Asset information is polled at regular intervals
  2. Timeout Protection: Requests that take too long are cancelled to prevent blocking
  3. Error Handling: Errors during polling are logged but don’t stop the polling process
  4. Graceful Cancellation: Polling can be gracefully stopped using a cancellation token

When implementing new REST-based asset providers, implement the AssetInfoProvider trait and use the start_polling function to handle the polling lifecycle.

Traits§

AssetInfoProvider
Trait for providers that can fetch asset information from REST APIs.

Functions§

start_polling
Starts polling asset information from a provider at the specified update interval.