pub struct WorldViewBuilder { /* private fields */ }Expand description
Periodically polls the heartbeat prefix and builds the world view.
Implementations§
Source§impl WorldViewBuilder
impl WorldViewBuilder
Sourcepub fn new(
storage: Arc<dyn StorageBackend>,
poll_interval: Duration,
dead_threshold: Duration,
) -> Self
pub fn new( storage: Arc<dyn StorageBackend>, poll_interval: Duration, dead_threshold: Duration, ) -> Self
Create a new world view builder.
Sourcepub fn world_view(&self) -> Arc<RwLock<WorldView>>
pub fn world_view(&self) -> Arc<RwLock<WorldView>>
Return a shared handle to the world view.
Sourcepub async fn build_once(&self) -> Result<WorldView>
pub async fn build_once(&self) -> Result<WorldView>
Build the world view once by reading all heartbeat files.
Sourcepub async fn poll_once(&self) -> Result<WorldView>
pub async fn poll_once(&self) -> Result<WorldView>
Poll once, update the shared world view, and return it.
Sourcepub async fn run(&self, cancel: Receiver<bool>)
pub async fn run(&self, cancel: Receiver<bool>)
Run the world view builder loop until cancellation.
Sourcepub async fn cleanup_stale(&self, cleanup_age: Duration) -> Result<usize>
pub async fn cleanup_stale(&self, cleanup_age: Duration) -> Result<usize>
Clean up heartbeat files for nodes that have been dead longer than cleanup_age.
Auto Trait Implementations§
impl Freeze for WorldViewBuilder
impl !RefUnwindSafe for WorldViewBuilder
impl Send for WorldViewBuilder
impl Sync for WorldViewBuilder
impl Unpin for WorldViewBuilder
impl UnsafeUnpin for WorldViewBuilder
impl !UnwindSafe for WorldViewBuilder
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