refactor: lazy pool key scheduling

This commit is contained in:
fawney19
2026-05-11 00:12:05 +08:00
parent 1a0f1a7b72
commit bacb14e5f0
26 changed files with 1856 additions and 223 deletions

View File

@@ -2,6 +2,7 @@ mod types;
pub use types::{
MinimalCandidateSelectionReadRepository, MinimalCandidateSelectionRepository,
StoredMinimalCandidateSelectionRow, StoredPoolKeyCandidateRowsQuery,
StoredProviderModelMapping, StoredRequestedModelCandidateRowsQuery,
StoredMinimalCandidateSelectionRow, StoredPoolKeyCandidateOrder,
StoredPoolKeyCandidateRowsQuery, StoredProviderModelMapping,
StoredRequestedModelCandidateRowsQuery,
};

View File

@@ -42,6 +42,18 @@ pub struct StoredMinimalCandidateSelectionRow {
pub model_is_available: bool,
}
#[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum StoredPoolKeyCandidateOrder {
#[default]
InternalPriority,
Lru,
CacheAffinity,
SingleAccount,
LoadBalance {
seed: String,
},
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct StoredPoolKeyCandidateRowsQuery {
pub api_format: String,
@@ -49,6 +61,8 @@ pub struct StoredPoolKeyCandidateRowsQuery {
pub endpoint_id: String,
pub model_id: String,
pub selected_provider_model_name: String,
#[serde(default)]
pub order: StoredPoolKeyCandidateOrder,
pub offset: u32,
pub limit: u32,
}