pub struct ConfigState { /* private fields */ }Expand description
Holds the currently published Snapshot behind an ArcSwap and owns
the monotonic generation counter. Shared across the dataplane (read) and
the config source / hot reload (write, DW-006). May carry the process’s
crate::events::EventBus (DW-044): every publish outcome emits one event
(config_published / config_rejected) onto it, which is why the bus
sits in a domain BELOW this one.
Implementations§
Source§impl ConfigState
impl ConfigState
pub fn new() -> Self
Sourcepub fn with_event_bus(bus: Arc<EventBus>) -> Self
pub fn with_event_bus(bus: Arc<EventBus>) -> Self
New state with its event bus attached from the start (DW-044): the binary’s wiring, so the very first (startup) publish already emits onto the bus the deliverer will drain.
Sourcepub fn attach_event_bus(&self, bus: Arc<EventBus>)
pub fn attach_event_bus(&self, bus: Arc<EventBus>)
Attach the event bus if none is attached yet (first attach wins; a live bus is never swapped underneath an emitter). Idempotent.
Sourcepub fn event_bus(&self) -> Option<Arc<EventBus>>
pub fn event_bus(&self) -> Option<Arc<EventBus>>
The attached event bus, if any (the dataplane adopts/creates it).
Sourcepub fn compile_and_publish(
&self,
gateway: &Gateway,
) -> Result<SnapshotInfo, CompileError>
pub fn compile_and_publish( &self, gateway: &Gateway, ) -> Result<SnapshotInfo, CompileError>
Validate, compile, and atomically publish. On ANY failure the currently-published snapshot is untouched (rollback = not-published); the generation counter is only advanced on success.
DW-044: emits config_published (generation, content hash, route
count) on success and config_rejected (issue count, plus the
generation still running) on failure — every publish path (cold
start, hot reload, admin POST) funnels through here, so one
emission site covers them all. Emission is the bus’s bounded
non-blocking hand-off; a full queue drops and counts.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ConfigState
impl !RefUnwindSafe for ConfigState
impl Send for ConfigState
impl Sync for ConfigState
impl Unpin for ConfigState
impl !UnwindSafe for ConfigState
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more