pub struct GenericServiceBase<C, S>where
C: ServiceConfig,
S: ServiceStats,{ /* private fields */ }Expand description
Generic service base providing common functionality for all services
Implementations§
Source§impl<C, S> GenericServiceBase<C, S>where
C: ServiceConfig,
S: ServiceStats,
impl<C, S> GenericServiceBase<C, S>where
C: ServiceConfig,
S: ServiceStats,
Sourcepub fn new(service_name: String, service_version: String) -> Self
pub fn new(service_name: String, service_version: String) -> Self
Creates a new service base with default configuration
Sourcepub fn with_config(
service_name: String,
service_version: String,
config: C,
) -> Result<Self, PipelineError>
pub fn with_config( service_name: String, service_version: String, config: C, ) -> Result<Self, PipelineError>
Creates a new service base with custom configuration
Sourcepub fn get_config(&self) -> Result<C, PipelineError>
pub fn get_config(&self) -> Result<C, PipelineError>
Gets the current configuration (read-only)
Sourcepub fn update_config(&self, new_config: C) -> Result<(), PipelineError>
pub fn update_config(&self, new_config: C) -> Result<(), PipelineError>
Updates the configuration after validation
Sourcepub fn merge_config(&self, partial_config: C) -> Result<(), PipelineError>
pub fn merge_config(&self, partial_config: C) -> Result<(), PipelineError>
Merges configuration with existing config
Sourcepub fn get_stats(&self) -> Result<S, PipelineError>
pub fn get_stats(&self) -> Result<S, PipelineError>
Gets current statistics (read-only)
Sourcepub fn update_stats<F>(&self, updater: F) -> Result<(), PipelineError>
pub fn update_stats<F>(&self, updater: F) -> Result<(), PipelineError>
Updates statistics
Sourcepub fn reset_stats(&self) -> Result<(), PipelineError>
pub fn reset_stats(&self) -> Result<(), PipelineError>
Resets all statistics
Sourcepub fn get_metadata(&self) -> &ServiceMetadata
pub fn get_metadata(&self) -> &ServiceMetadata
Gets service metadata
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Checks if the service is healthy
Sourcepub fn set_health(&self, healthy: bool)
pub fn set_health(&self, healthy: bool)
Sets the health status
Sourcepub fn get_service_summary(
&self,
) -> Result<HashMap<String, String>, PipelineError>
pub fn get_service_summary( &self, ) -> Result<HashMap<String, String>, PipelineError>
Gets a summary of service status
Auto Trait Implementations§
impl<C, S> !Freeze for GenericServiceBase<C, S>
impl<C, S> RefUnwindSafe for GenericServiceBase<C, S>
impl<C, S> Send for GenericServiceBase<C, S>
impl<C, S> Sync for GenericServiceBase<C, S>
impl<C, S> Unpin for GenericServiceBase<C, S>
impl<C, S> UnwindSafe for GenericServiceBase<C, S>
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> 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 more