pub struct AdminDisableStore { /* private fields */ }Expand description
A single-document, atomically-persisted store of current
AdminDisableRecords keyed by worker id. Same corruption tolerance as
BypassRecordStore: a missing or unreadable file yields an empty store
and never blocks daemon startup (the failure mode is “worker rejoins until
re-disabled”, the pre-existing behavior).
Implementations§
Source§impl AdminDisableStore
impl AdminDisableStore
Sourcepub fn with_path(path: impl Into<PathBuf>) -> Self
pub fn with_path(path: impl Into<PathBuf>) -> Self
An empty store bound to path (nothing read from disk).
Sourcepub fn load(path: impl Into<PathBuf>) -> Self
pub fn load(path: impl Into<PathBuf>) -> Self
Load the store from path; missing/corrupt files yield an empty store.
Sourcepub fn get(&self, worker_id: &str) -> Option<&AdminDisableRecord>
pub fn get(&self, worker_id: &str) -> Option<&AdminDisableRecord>
The current record for a worker, if disabled.
Sourcepub fn all(&self) -> Vec<&AdminDisableRecord>
pub fn all(&self) -> Vec<&AdminDisableRecord>
All current records, ordered by worker id.
Sourcepub fn upsert(&mut self, record: AdminDisableRecord) -> Result<()>
pub fn upsert(&mut self, record: AdminDisableRecord) -> Result<()>
Record a worker disable and persist the store.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AdminDisableStore
impl RefUnwindSafe for AdminDisableStore
impl Send for AdminDisableStore
impl Sync for AdminDisableStore
impl Unpin for AdminDisableStore
impl UnsafeUnpin for AdminDisableStore
impl UnwindSafe for AdminDisableStore
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