v0.2.5-pre.009
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-onchain-transport-lib/src/pool.rs
|
||||
// version: 5
|
||||
// version: 6
|
||||
|
||||
/// Safe snapshot of the logical HTTP endpoint pool.
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
@@ -74,8 +74,8 @@ impl HttpEndpointSelection {
|
||||
pub struct HttpRequestPermit {
|
||||
selection: crate::HttpEndpointSelection,
|
||||
deadline: std::time::Instant,
|
||||
role_runtime: std::sync::Arc<crate::resilience::HttpRoleRuntime>,
|
||||
_concurrency_permit: crate::resilience::HttpConcurrencyPermit,
|
||||
role_runtime: std::sync::Arc<crate::HttpRoleRuntime>,
|
||||
_concurrency_permit: crate::HttpConcurrencyPermit,
|
||||
}
|
||||
|
||||
impl HttpRequestPermit {
|
||||
@@ -165,14 +165,6 @@ pub struct HttpTransportPool {
|
||||
inner: std::sync::Arc<HttpTransportPoolInner>,
|
||||
}
|
||||
|
||||
struct HttpTransportPoolInner {
|
||||
clients: std::vec::Vec<crate::HttpEndpointClient>,
|
||||
retry: crate::HttpRetrySettings,
|
||||
notify: std::sync::Arc<tokio::sync::Notify>,
|
||||
request_ids: std::sync::atomic::AtomicU64,
|
||||
cursors: std::sync::Mutex<std::collections::BTreeMap<(std::string::String, std::string::String, u32), usize>>,
|
||||
}
|
||||
|
||||
impl HttpTransportPool {
|
||||
/// Builds a logical endpoint pool after validating all Transport-owned runtime settings.
|
||||
pub fn new(settings: crate::HttpTransportSettings) -> ksp_core_lib::Result<Self> {
|
||||
@@ -369,7 +361,7 @@ impl HttpTransportPool {
|
||||
let candidate = &candidates[position];
|
||||
let admission = candidate.runtime.try_acquire(now);
|
||||
match admission {
|
||||
crate::resilience::RoleAdmissionAttempt::Ready(concurrency_permit) => {
|
||||
crate::RoleAdmissionAttempt::Ready(concurrency_permit) => {
|
||||
let selection_result = self.selection_from_runtime_candidate(role, request_kind, candidate);
|
||||
let selection = match selection_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
@@ -391,13 +383,13 @@ impl HttpTransportPool {
|
||||
_concurrency_permit: concurrency_permit,
|
||||
});
|
||||
},
|
||||
crate::resilience::RoleAdmissionAttempt::BlockedUntil(ready_at) => {
|
||||
crate::RoleAdmissionAttempt::BlockedUntil(ready_at) => {
|
||||
earliest_ready = earlier_instant(earliest_ready, ready_at);
|
||||
},
|
||||
crate::resilience::RoleAdmissionAttempt::ConcurrencySaturated => {
|
||||
crate::RoleAdmissionAttempt::ConcurrencySaturated => {
|
||||
concurrency_saturated = true;
|
||||
},
|
||||
crate::resilience::RoleAdmissionAttempt::Unavailable => {},
|
||||
crate::RoleAdmissionAttempt::Unavailable => {},
|
||||
}
|
||||
offset = offset.saturating_add(1);
|
||||
}
|
||||
@@ -548,6 +540,14 @@ impl std::fmt::Debug for HttpTransportPool {
|
||||
}
|
||||
}
|
||||
|
||||
struct HttpTransportPoolInner {
|
||||
clients: std::vec::Vec<crate::HttpEndpointClient>,
|
||||
retry: crate::HttpRetrySettings,
|
||||
notify: std::sync::Arc<tokio::sync::Notify>,
|
||||
request_ids: std::sync::atomic::AtomicU64,
|
||||
cursors: std::sync::Mutex<std::collections::BTreeMap<(std::string::String, std::string::String, u32), usize>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
struct PoolCandidate {
|
||||
client_index: usize,
|
||||
@@ -557,7 +557,7 @@ struct PoolCandidate {
|
||||
struct RuntimePoolCandidate {
|
||||
client_index: usize,
|
||||
priority: u32,
|
||||
runtime: std::sync::Arc<crate::resilience::HttpRoleRuntime>,
|
||||
runtime: std::sync::Arc<crate::HttpRoleRuntime>,
|
||||
}
|
||||
|
||||
enum RuntimeSelectionAttempt {
|
||||
|
||||
Reference in New Issue
Block a user