pub struct ServiceManager {
pub service_instances: HashMap<String, u32>,
pub resource_pools: HashMap<String, ResourcePool>,
/* private fields */
}Expand description
Intelligent Service Manager
Fields§
§service_instances: HashMap<String, u32>Current service instances count
resource_pools: HashMap<String, ResourcePool>Resource pools
Implementations§
Source§impl ServiceManager
impl ServiceManager
Sourcepub fn record_metrics(&mut self, metrics: ServiceMetrics)
pub fn record_metrics(&mut self, metrics: ServiceMetrics)
Record service metrics
Sourcepub fn set_auto_scale_config(
&mut self,
service_id: String,
config: AutoScaleConfig,
)
pub fn set_auto_scale_config( &mut self, service_id: String, config: AutoScaleConfig, )
Set auto-scaling configuration for a service
Sourcepub fn predict_load(
&self,
service_id: &str,
horizon_minutes: u32,
) -> Option<ServiceMetrics>
pub fn predict_load( &self, service_id: &str, horizon_minutes: u32, ) -> Option<ServiceMetrics>
Predict service load
Sourcepub fn determine_scaling_action(
&mut self,
service_id: &str,
) -> Result<ScalingAction>
pub fn determine_scaling_action( &mut self, service_id: &str, ) -> Result<ScalingAction>
Determine scaling action based on metrics and prediction
Sourcepub fn update_instance_count(&mut self, service_id: String, count: u32)
pub fn update_instance_count(&mut self, service_id: String, count: u32)
Update service instance count
Sourcepub fn predict_service_health(&self, service_id: &str) -> Result<HealthStatus>
pub fn predict_service_health(&self, service_id: &str) -> Result<HealthStatus>
Predict service health
Sourcepub fn get_or_create_pool(
&mut self,
service_name: String,
max_size: usize,
) -> &mut ResourcePool
pub fn get_or_create_pool( &mut self, service_name: String, max_size: usize, ) -> &mut ResourcePool
Get or create resource pool for a service
Sourcepub fn generate_cost_recommendations(
&self,
service_id: &str,
) -> Vec<CostRecommendation>
pub fn generate_cost_recommendations( &self, service_id: &str, ) -> Vec<CostRecommendation>
Generate cost optimization recommendations
Sourcepub fn get_summary(&self) -> HashMap<String, Value>
pub fn get_summary(&self) -> HashMap<String, Value>
Get summary statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ServiceManager
impl RefUnwindSafe for ServiceManager
impl Send for ServiceManager
impl Sync for ServiceManager
impl Unpin for ServiceManager
impl UnwindSafe for ServiceManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request