pub struct HeartbeatWriter { /* private fields */ }Expand description
Writes the local node’s heartbeat to storage at a regular interval.
Implementations§
Source§impl HeartbeatWriter
impl HeartbeatWriter
Sourcepub fn new(
storage: Arc<dyn StorageBackend>,
config: &NodeConfig,
bee_pool: Arc<BeePool>,
cell_cache: Arc<CellCache>,
) -> Self
pub fn new( storage: Arc<dyn StorageBackend>, config: &NodeConfig, bee_pool: Arc<BeePool>, cell_cache: Arc<CellCache>, ) -> Self
Create a new heartbeat writer from a node config and bee pool.
Sourcepub async fn collect_heartbeat(&self) -> Heartbeat
pub async fn collect_heartbeat(&self) -> Heartbeat
Collect a heartbeat snapshot from the current node state.
Sourcepub async fn write_once(&self) -> Result<()>
pub async fn write_once(&self) -> Result<()>
Write a single heartbeat to storage.
Sourcepub async fn run(&self, cancel: Receiver<bool>)
pub async fn run(&self, cancel: Receiver<bool>)
Run the heartbeat writer loop until the cancellation token fires.
Sourcepub async fn delete_heartbeat(&self) -> Result<()>
pub async fn delete_heartbeat(&self) -> Result<()>
Delete this node’s heartbeat file (graceful departure).
Auto Trait Implementations§
impl !Freeze for HeartbeatWriter
impl !RefUnwindSafe for HeartbeatWriter
impl Send for HeartbeatWriter
impl Sync for HeartbeatWriter
impl Unpin for HeartbeatWriter
impl UnsafeUnpin for HeartbeatWriter
impl !UnwindSafe for HeartbeatWriter
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