feat: add load balancer score and frontend integration
- Implemented `OKDLoadBalancerScore` and integrated it as a `FrontendScore`. - Added `FrontendScore` trait for TUI displayable scores. - Implemented `Display` for `OKDLoadBalancerScore`. - Updated `ScoreListWidget` to handle `FrontendScore` types. - Included load balancer score in the TUI.
This commit is contained in:
@@ -19,3 +19,5 @@ where
|
||||
Box::new(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
pub trait FrontendScore<T: Topology>: Score<T> + std::fmt::Display {}
|
||||
|
||||
@@ -334,6 +334,7 @@ impl TftpServer for DummyInfra {
|
||||
#[async_trait]
|
||||
impl HttpServer for DummyInfra {
|
||||
async fn serve_files(&self, _url: &Url) -> Result<(), ExecutorError> {
|
||||
|
||||
unimplemented!("{}", UNIMPLEMENTED_DUMMY_INFRA)
|
||||
}
|
||||
fn get_ip(&self) -> IpAddress {
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::{
|
||||
data::{Id, Version},
|
||||
interpret::{Interpret, InterpretError, InterpretName, InterpretStatus, Outcome},
|
||||
inventory::Inventory,
|
||||
score::Score,
|
||||
score::{FrontendScore, Score},
|
||||
topology::{LoadBalancer, LoadBalancerService, Topology},
|
||||
};
|
||||
|
||||
@@ -19,6 +19,8 @@ pub struct LoadBalancerScore {
|
||||
// uuid?
|
||||
}
|
||||
|
||||
impl <T: Topology + LoadBalancer> FrontendScore<T> for LoadBalancerScore {}
|
||||
|
||||
impl<T: Topology + LoadBalancer> Score<T> for LoadBalancerScore {
|
||||
fn create_interpret(&self) -> Box<dyn Interpret<T>> {
|
||||
Box::new(LoadBalancerInterpret::new(self.clone()))
|
||||
|
||||
@@ -3,12 +3,20 @@ use std::net::SocketAddr;
|
||||
use crate::{
|
||||
interpret::Interpret,
|
||||
modules::load_balancer::LoadBalancerScore,
|
||||
score::Score,
|
||||
score::{FrontendScore, Score},
|
||||
topology::{
|
||||
BackendServer, HAClusterTopology, HealthCheck, HttpMethod, HttpStatusCode, LoadBalancer, LoadBalancerService, Topology
|
||||
},
|
||||
};
|
||||
|
||||
impl std::fmt::Display for OKDLoadBalancerScore {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl <T: Topology + LoadBalancer> FrontendScore<T> for OKDLoadBalancerScore {}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct OKDLoadBalancerScore {
|
||||
load_balancer_score: LoadBalancerScore,
|
||||
|
||||
Reference in New Issue
Block a user