pub struct BrokerState {
pub log_path: Option<PathBuf>,
/* private fields */
}Expand description
Shared broker state.
Wraps BrokerStateInner in an RwLock for concurrent read access.
The sequence counter is a standalone AtomicU64 outside the lock so
that sequence numbers can be allocated without coupling to the write
lock.
Fields§
§log_path: Option<PathBuf>Optional path for periodic log flush to disk.
Implementations§
Source§impl BrokerState
impl BrokerState
Sourcepub fn read(&self) -> RwLockReadGuard<'_, BrokerStateInner>
pub fn read(&self) -> RwLockReadGuard<'_, BrokerStateInner>
Acquires a read lock on the inner state.
§Panics
Panics if the lock is poisoned (a thread panicked while holding it).
Sourcepub fn write(&self) -> RwLockWriteGuard<'_, BrokerStateInner>
pub fn write(&self) -> RwLockWriteGuard<'_, BrokerStateInner>
Acquires a write lock on the inner state.
§Panics
Panics if the lock is poisoned (a thread panicked while holding it).
Sourcepub fn uptime_seconds(&self) -> u64
pub fn uptime_seconds(&self) -> u64
Returns the number of seconds since the broker was started.
Used by the HTTP /status handler to report uptime.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for BrokerState
impl RefUnwindSafe for BrokerState
impl Send for BrokerState
impl Sync for BrokerState
impl Unpin for BrokerState
impl UnsafeUnpin for BrokerState
impl UnwindSafe for BrokerState
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