v0.2.11-pre.004
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-offchain-transport-lib/src/lib.rs
|
||||
// version: 5
|
||||
// version: 6
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![deny(unreachable_pub)]
|
||||
@@ -7,20 +7,21 @@
|
||||
|
||||
//! KSP-owned off-chain transport foundation.
|
||||
//!
|
||||
//! `0.2.11-pre.003` keeps the first capability family deliberately narrow (`market_price`, SOL/USD only) while staging crate-wide hardened HTTP REST
|
||||
//! primitives and non-blocking local admission/cooldown machinery under `cfg(test)` until the first production adapter consumes them in `pre.004`.
|
||||
//! These `http_*` internals are shared transport mechanics for future off-chain capability families such as `swap_quote_*`; they are intentionally not
|
||||
//! re-exported as a generic consumer HTTP client. Provider wire DTOs, provider adapters, Config integration and refresh orchestration remain outside this
|
||||
//! tranche.
|
||||
//! `0.2.11-pre.004` keeps the first capability family deliberately narrow (`market_price`, SOL/USD only), activates the crate-wide hardened `http_*`
|
||||
//! primitives in production, and introduces the first three direct-REST adapters: CoinGecko, CoinMarketCap and CoinPaprika. Provider wire DTOs remain
|
||||
//! private, no provider SDK is used, and the `http_*` internals are not re-exported as a generic consumer HTTP client. Config integration and generic
|
||||
//! registry/refresh orchestration remain outside this tranche.
|
||||
|
||||
mod constants;
|
||||
mod error;
|
||||
#[cfg(test)] // RUST-API-008: staged until the first production adapter consumes the HTTP admission path in pre.004.
|
||||
mod http_admission;
|
||||
#[cfg(test)] // RUST-API-008: staged until the first production adapter consumes the HTTP client path in pre.004.
|
||||
mod http_client;
|
||||
#[cfg(test)] // RUST-API-008: staged until the first production adapter consumes the HTTP settings path in pre.004.
|
||||
mod http_settings;
|
||||
mod market_price_adapter;
|
||||
mod market_price_api_key;
|
||||
mod market_price_coingecko;
|
||||
mod market_price_coinmarketcap;
|
||||
mod market_price_coinpaprika;
|
||||
mod market_price_decimal;
|
||||
mod market_price_observation;
|
||||
mod market_price_provider;
|
||||
@@ -28,6 +29,8 @@ mod market_price_settings;
|
||||
|
||||
/// Stable error code for HTTP access denial.
|
||||
pub use self::error::ERROR_CODE_HTTP_ACCESS_DENIED;
|
||||
/// Stable error code for local HTTP request deferral.
|
||||
pub use self::error::ERROR_CODE_HTTP_ADMISSION_DEFERRED;
|
||||
/// Stable error code for hardened HTTP client initialization failure.
|
||||
pub use self::error::ERROR_CODE_HTTP_CLIENT_BUILD_FAILED;
|
||||
/// Stable error code for an off-chain HTTP connection failure.
|
||||
@@ -56,10 +59,30 @@ pub use self::error::ERROR_CODE_MARKET_PRICE_DECIMAL_INVALID;
|
||||
pub use self::error::ERROR_CODE_MARKET_PRICE_OBSERVATION_INVALID;
|
||||
/// Stable error code for an invalid provider descriptor.
|
||||
pub use self::error::ERROR_CODE_MARKET_PRICE_PROVIDER_DESCRIPTOR_INVALID;
|
||||
/// Stable error code returned when a disabled provider is invoked directly.
|
||||
pub use self::error::ERROR_CODE_MARKET_PRICE_PROVIDER_DISABLED;
|
||||
/// Stable error code for an invalid provider identifier.
|
||||
pub use self::error::ERROR_CODE_MARKET_PRICE_PROVIDER_ID_INVALID;
|
||||
/// Stable error code for a provider response that violates its adapter contract.
|
||||
pub use self::error::ERROR_CODE_MARKET_PRICE_PROVIDER_RESPONSE_INVALID;
|
||||
/// Stable error code for invalid common provider settings.
|
||||
pub use self::error::ERROR_CODE_MARKET_PRICE_PROVIDER_SETTINGS_INVALID;
|
||||
/// CoinGecko V1 access mode.
|
||||
pub use self::market_price_coingecko::MarketPriceCoinGeckoAccessMode;
|
||||
/// CoinGecko SOL/USD provider adapter.
|
||||
pub use self::market_price_coingecko::MarketPriceCoinGeckoProvider;
|
||||
/// CoinGecko runtime settings.
|
||||
pub use self::market_price_coingecko::MarketPriceCoinGeckoSettings;
|
||||
/// CoinMarketCap V1 access mode.
|
||||
pub use self::market_price_coinmarketcap::MarketPriceCoinMarketCapAccessMode;
|
||||
/// CoinMarketCap SOL/USD provider adapter.
|
||||
pub use self::market_price_coinmarketcap::MarketPriceCoinMarketCapProvider;
|
||||
/// CoinMarketCap runtime settings.
|
||||
pub use self::market_price_coinmarketcap::MarketPriceCoinMarketCapSettings;
|
||||
/// CoinPaprika SOL/USD provider adapter.
|
||||
pub use self::market_price_coinpaprika::MarketPriceCoinPaprikaProvider;
|
||||
/// CoinPaprika runtime settings.
|
||||
pub use self::market_price_coinpaprika::MarketPriceCoinPaprikaSettings;
|
||||
/// Maximum accepted byte length for one textual decimal input.
|
||||
pub use self::market_price_decimal::MARKET_PRICE_DECIMAL_MAX_INPUT_BYTES;
|
||||
/// Maximum decimal scale retained by the canonical SOL/USD price representation.
|
||||
@@ -110,26 +133,38 @@ pub use self::market_price_settings::MarketPriceProviderCommonSettings;
|
||||
/// Owning tracing target for events emitted by Off-chain Transport.
|
||||
pub(crate) use self::constants::TRACING_TARGET;
|
||||
/// Maximum provider-directed cooldown accepted from a server `Retry-After` value.
|
||||
#[cfg(test)]
|
||||
pub(crate) use self::http_admission::HTTP_MAX_RETRY_AFTER;
|
||||
/// Crate-internal non-blocking request-admission controller.
|
||||
#[cfg(test)]
|
||||
pub(crate) use self::http_admission::HttpAdmissionController;
|
||||
/// Crate-internal result of one immediate request-admission attempt.
|
||||
#[cfg(test)]
|
||||
pub(crate) use self::http_admission::HttpAdmissionDecision;
|
||||
/// Crate-internal provider-neutral local request-admission policy.
|
||||
#[cfg(test)]
|
||||
pub(crate) use self::http_admission::HttpAdmissionPolicy;
|
||||
/// Crate-internal fixed-origin GET request with redacted diagnostics.
|
||||
#[cfg(test)]
|
||||
pub(crate) use self::http_client::HttpGetRequest;
|
||||
/// Crate-internal bounded syntactically valid JSON response document.
|
||||
#[cfg(test)]
|
||||
pub(crate) use self::http_client::HttpJsonDocument;
|
||||
/// Crate-internal hardened REST client shared by capability adapters.
|
||||
#[cfg(test)]
|
||||
pub(crate) use self::http_client::HttpRestClient;
|
||||
/// Crate-internal bounded HTTP runtime settings.
|
||||
#[cfg(test)]
|
||||
pub(crate) use self::http_settings::HttpClientSettings;
|
||||
/// Applies one market-price request admission decision.
|
||||
pub(crate) use self::market_price_adapter::admit_request;
|
||||
/// Captures the current market-price wall-clock timestamp.
|
||||
pub(crate) use self::market_price_adapter::current_timestamp;
|
||||
/// Executes one market-price HTTP GET with rate-limit feedback.
|
||||
pub(crate) use self::market_price_adapter::get_json;
|
||||
/// Builds one safe invalid-provider-response error.
|
||||
pub(crate) use self::market_price_adapter::invalid_provider_response;
|
||||
/// Builds one safe invalid-provider-response error with parser source.
|
||||
pub(crate) use self::market_price_adapter::invalid_provider_response_with_source;
|
||||
/// Parses one RFC 3339 provider market-price timestamp.
|
||||
pub(crate) use self::market_price_adapter::market_price_timestamp_from_rfc3339;
|
||||
/// Converts whole Unix seconds into a market-price timestamp.
|
||||
pub(crate) use self::market_price_adapter::market_price_timestamp_from_unix_seconds;
|
||||
/// Builds the disabled-provider error used by direct adapters.
|
||||
pub(crate) use self::market_price_adapter::provider_disabled_error;
|
||||
/// Builds common HTTP runtime primitives for one market-price provider.
|
||||
pub(crate) use self::market_price_adapter::provider_http_runtime;
|
||||
/// Crate-internal redacted holder for provider API keys.
|
||||
pub(crate) use self::market_price_api_key::MarketPriceApiKey;
|
||||
|
||||
Reference in New Issue
Block a user