pub struct StoreRouter { /* private fields */ }Expand description
Registers named SchedulerStore backends at host boot.
Use for multi-store hosts or a single default via DEFAULT_STORE_NAME. Typical Mode 1
flow:
Self::register_global(orinstall_default_mem_storefrom the mem backend).ChrononBuilder::scheduler_store_from_global().
Prefer passing a store directly to ChrononBuilder::scheduler_store in Mode 2/3 when each
binary already shares connection URLs — the global router is optional convenience for
single-process boots, not a substitute for a shared durable database.
Thread-safe when accessed through Self::register_global / default_store_from_global;
direct mutation requires exclusive access to the router instance.
§Examples
StoreRouter::register_global(DEFAULT_STORE_NAME, store);Runnable end-to-end: cargo run -p uf-chronon --example store_router_boot --features mem.
Implementations§
Source§impl StoreRouter
impl StoreRouter
Sourcepub fn new() -> StoreRouter
pub fn new() -> StoreRouter
Create an empty router (no stores registered).
Sourcepub fn register(
&mut self,
name: impl Into<String>,
store: Arc<dyn SchedulerStore>,
)
pub fn register( &mut self, name: impl Into<String>, store: Arc<dyn SchedulerStore>, )
Register a store under a logical name (overwrites any previous entry).
Sourcepub fn get(&self, name: &str) -> Option<Arc<dyn SchedulerStore>>
pub fn get(&self, name: &str) -> Option<Arc<dyn SchedulerStore>>
Resolve a registered store by name.
Sourcepub fn install_global(router: StoreRouter)
pub fn install_global(router: StoreRouter)
Replace the process-global router (typically once at startup).
Subsequent calls are ignored; the first successful install wins.
Sourcepub fn register_global(name: impl Into<String>, store: Arc<dyn SchedulerStore>)
pub fn register_global(name: impl Into<String>, store: Arc<dyn SchedulerStore>)
Register a store on the process-global router.
§Examples
StoreRouter::register_global(DEFAULT_STORE_NAME, store);Panics if the global router lock is poisoned.
Trait Implementations§
Source§impl Default for StoreRouter
impl Default for StoreRouter
Source§fn default() -> StoreRouter
fn default() -> StoreRouter
Auto Trait Implementations§
impl !RefUnwindSafe for StoreRouter
impl !UnwindSafe for StoreRouter
impl Freeze for StoreRouter
impl Send for StoreRouter
impl Sync for StoreRouter
impl Unpin for StoreRouter
impl UnsafeUnpin for StoreRouter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 more