pub struct ServerState {Show 13 fields
pub config: RwLock<GeneratorConfig>,
pub config_source: RwLock<ConfigSource>,
pub total_entries: AtomicU64,
pub total_anomalies: AtomicU64,
pub active_streams: AtomicU64,
pub total_stream_events: AtomicU64,
pub stream_paused: AtomicBool,
pub stream_stopped: AtomicBool,
pub stream_events_per_second: AtomicU64,
pub stream_max_events: AtomicU64,
pub stream_inject_anomalies: AtomicBool,
pub triggered_pattern: RwLock<Option<String>>,
pub resource_guard: Arc<ResourceGuard>,
/* private fields */
}Expand description
Server state for tracking metrics and configuration.
Fields§
§config: RwLock<GeneratorConfig>Current configuration
config_source: RwLock<ConfigSource>Configuration source for reloading
total_entries: AtomicU64Total entries generated
total_anomalies: AtomicU64Total anomalies injected
active_streams: AtomicU64Active streams count
total_stream_events: AtomicU64Total stream events
stream_paused: AtomicBoolStream control flag
stream_stopped: AtomicBoolStream stop flag
stream_events_per_second: AtomicU64Stream events per second (0 = unlimited)
stream_max_events: AtomicU64Stream maximum events (0 = unlimited)
stream_inject_anomalies: AtomicBoolStream anomaly injection flag
triggered_pattern: RwLock<Option<String>>Triggered pattern name (if any) - will be applied to next generated entries
resource_guard: Arc<ResourceGuard>Resource guard for memory and disk monitoring
Implementations§
Source§impl ServerState
impl ServerState
pub fn new(config: GeneratorConfig) -> Self
Sourcepub fn with_resource_limits(
config: GeneratorConfig,
memory_limit_mb: usize,
) -> Self
pub fn with_resource_limits( config: GeneratorConfig, memory_limit_mb: usize, ) -> Self
Create with custom resource limits.
pub fn uptime_seconds(&self) -> u64
Sourcepub fn check_resources(&self) -> Result<DegradationLevel, Status>
pub fn check_resources(&self) -> Result<DegradationLevel, Status>
Check if resources are available for a new generation.
Sourcepub fn resource_status(&self) -> ResourceStatus
pub fn resource_status(&self) -> ResourceStatus
Get current resource status for monitoring.
Auto Trait Implementations§
impl !Freeze for ServerState
impl !RefUnwindSafe for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl UnsafeUnpin for ServerState
impl !UnwindSafe for ServerState
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 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> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.