pub struct ManagementState {Show 13 fields
pub mocks: Arc<RwLock<Vec<MockConfig>>>,
pub spec: Option<Arc<OpenApiSpec>>,
pub spec_path: Option<String>,
pub port: u16,
pub start_time: Instant,
pub request_counter: Arc<RwLock<u64>>,
pub proxy_config: Option<Arc<RwLock<ProxyConfig>>>,
pub state_machine_manager: Arc<RwLock<ScenarioStateMachineManager>>,
pub ws_broadcast: Option<Arc<Sender<MockEvent>>>,
pub lifecycle_hooks: Option<Arc<LifecycleHookRegistry>>,
pub rule_explanations: Arc<RwLock<HashMap<String, RuleExplanation>>>,
pub server_config: Option<Arc<RwLock<ServerConfig>>>,
pub base_path: Option<String>,
}Expand description
Shared state for the management API
Fields§
§mocks: Arc<RwLock<Vec<MockConfig>>>Collection of mock configurations
spec: Option<Arc<OpenApiSpec>>Optional OpenAPI specification
spec_path: Option<String>Optional path to the OpenAPI spec file
port: u16Server port number
start_time: InstantServer start time for uptime calculation
request_counter: Arc<RwLock<u64>>Counter for total requests processed
proxy_config: Option<Arc<RwLock<ProxyConfig>>>Optional proxy configuration for migration pipeline
state_machine_manager: Arc<RwLock<ScenarioStateMachineManager>>State machine manager for scenario state machines
ws_broadcast: Option<Arc<Sender<MockEvent>>>Optional WebSocket broadcast channel for real-time updates
lifecycle_hooks: Option<Arc<LifecycleHookRegistry>>Lifecycle hook registry for extensibility
rule_explanations: Arc<RwLock<HashMap<String, RuleExplanation>>>Rule explanations storage (in-memory for now)
server_config: Option<Arc<RwLock<ServerConfig>>>Optional server configuration for profile application
base_path: Option<String>Issue #79 round 20 — the API base path the server was started with
(e.g. /api). When MOCKFORGE_SHADOW_MODE=true, the dynamic-mock
fallback returns 200 only for requests whose path is under this
prefix, and 404 otherwise. Pre-round-20, shadow returned 200 for
every unmatched path, including paths outside the configured
surface (e.g. /api123/... when the server is /api). Empty or
None means no prefix gate.
Implementations§
Source§impl ManagementState
impl ManagementState
Sourcepub fn new(
spec: Option<Arc<OpenApiSpec>>,
spec_path: Option<String>,
port: u16,
) -> Self
pub fn new( spec: Option<Arc<OpenApiSpec>>, spec_path: Option<String>, port: u16, ) -> Self
Create a new management state
§Arguments
spec- Optional OpenAPI specificationspec_path- Optional path to the OpenAPI spec fileport- Server port number
Sourcepub fn with_base_path(self, base_path: Option<String>) -> Self
pub fn with_base_path(self, base_path: Option<String>) -> Self
Set the API base path (e.g. /api). Required for shadow-mode’s
base-path gate (#79 round 20). Normalises by trimming trailing
/, and treats empty / / as None.
Sourcepub fn with_lifecycle_hooks(self, hooks: Arc<LifecycleHookRegistry>) -> Self
pub fn with_lifecycle_hooks(self, hooks: Arc<LifecycleHookRegistry>) -> Self
Add lifecycle hook registry to management state
Sourcepub fn with_ws_broadcast(self, ws_broadcast: Arc<Sender<MockEvent>>) -> Self
pub fn with_ws_broadcast(self, ws_broadcast: Arc<Sender<MockEvent>>) -> Self
Add WebSocket broadcast channel to management state
Sourcepub fn with_proxy_config(self, proxy_config: Arc<RwLock<ProxyConfig>>) -> Self
pub fn with_proxy_config(self, proxy_config: Arc<RwLock<ProxyConfig>>) -> Self
Add proxy configuration to management state
Sourcepub fn with_server_config(
self,
server_config: Arc<RwLock<ServerConfig>>,
) -> Self
pub fn with_server_config( self, server_config: Arc<RwLock<ServerConfig>>, ) -> Self
Add server configuration to management state
Trait Implementations§
Source§impl Clone for ManagementState
impl Clone for ManagementState
Source§fn clone(&self) -> ManagementState
fn clone(&self) -> ManagementState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ManagementState
impl !UnwindSafe for ManagementState
impl Freeze for ManagementState
impl Send for ManagementState
impl Sync for ManagementState
impl Unpin for ManagementState
impl UnsafeUnpin for ManagementState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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>
T in a tonic::Request