pub struct Metadata { /* private fields */ }Expand description
The daemon’s daemon.json record as this image holds it, and the writes
of it: the start write, Self::publish (reload, and the restore after
a failed exec), Self::heal (Ping) and Self::cleanup (shutdown).
One metadata lock serializes them all: each changes the held record and
writes the files inside the same critical section, so a heal can never
write a record older than the one held, and after the cleanup nothing
writes the files back. Lock order: a caller that also holds the daemon’s
lock_fd mutex (heal, cleanup) takes that first. The lock is never held
across an await.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn start(paths: DaemonPaths, info: DaemonInfo) -> Result<Self>
pub fn start(paths: DaemonPaths, info: DaemonInfo) -> Result<Self>
Hold info and write it (the start write).
Sourcepub fn info(&self) -> DaemonInfo
pub fn info(&self) -> DaemonInfo
The record this image holds (a copy).
Sourcepub fn publish(&self, info: DaemonInfo) -> Result<()>
pub fn publish(&self, info: DaemonInfo) -> Result<()>
Hold info and write it, under the metadata lock. After the cleanup
it is only held.
Sourcepub fn heal(&self, lock: &DaemonLock) -> Result<Healed>
pub fn heal(&self, lock: &DaemonLock) -> Result<Healed>
heal_daemon_json with the held record, under the metadata lock;
counts the heal for the INFO line’s rate limit.
Sourcepub fn cleanup(&self, lock: &DaemonLock) -> bool
pub fn cleanup(&self, lock: &DaemonLock) -> bool
[cleanup_metadata] (shutdown), under the metadata lock; no later
publish or heal writes the files.
Auto Trait Implementations§
impl !Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnsafeUnpin for Metadata
impl UnwindSafe for Metadata
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.