Struct sn_dysfunction::DysfunctionDetection
source · pub struct DysfunctionDetection {
pub communication_issues: BTreeMap<XorName, VecDeque<Instant>>,
pub dkg_issues: BTreeMap<XorName, VecDeque<Instant>>,
pub probe_issues: BTreeMap<XorName, VecDeque<Instant>>,
pub knowledge_issues: BTreeMap<XorName, VecDeque<Instant>>,
pub unfulfilled_ops: BTreeMap<XorName, Vec<(OperationId, Instant)>>,
/* private fields */
}
Expand description
Dysfunctional node tracking. Allows various potential issues to be tracked and weighted, with unresposive or suspect nodes being noted on request, against which action can then be taken.
Fields§
§communication_issues: BTreeMap<XorName, VecDeque<Instant>>
The communication issues logged against a node, along with a timestamp.
dkg_issues: BTreeMap<XorName, VecDeque<Instant>>
The dkg issues logged against a node, along with a timestamp to expire after some time.
probe_issues: BTreeMap<XorName, VecDeque<Instant>>
The probe issues logged against a node and as yet unfulfilled, along with a timestamp to expire after some time.
knowledge_issues: BTreeMap<XorName, VecDeque<Instant>>
The knowledge issues logged against a node, along with a timestamp.
unfulfilled_ops: BTreeMap<XorName, Vec<(OperationId, Instant)>>
The unfulfilled pending request operation issues logged against a node, along with an operation ID.
Implementations§
source§impl DysfunctionDetection
impl DysfunctionDetection
sourcepub fn calculate_scores(&self) -> ScoreResults
pub fn calculate_scores(&self) -> ScoreResults
Calculate the scores of all nodes being tracked and return them in a node -> score map. There is a map for each type of issue.
The ‘score’ for a node is the number of issues logged against that node, minus the average of the number of issues at all the other nodes.
These scores can then be used to highlight nodes that have a higher score than some particular ratio.
sourcepub fn get_dysfunctional_nodes(&mut self) -> BTreeSet<XorName>
pub fn get_dysfunctional_nodes(&mut self) -> BTreeSet<XorName>
Get a list of nodes whose score is DYSFUNCTION_SCORE_THRESHOLD
TODO: order these to act upon most dysfunctional first
(the nodes must all ProposeOffline
over a dysfunctional node and then immediately vote it off. So any other membershipn changes in flight could block this.
thus, we need to be callling this function often until nodes are removed.)
source§impl DysfunctionDetection
impl DysfunctionDetection
sourcepub fn track_issue(&mut self, node_id: XorName, issue_type: IssueType)
pub fn track_issue(&mut self, node_id: XorName, issue_type: IssueType)
Adds an issue to the dysfunction tracker.
The op_id
only applies when adding an operational issue.
sourcepub fn request_operation_fulfilled(
&mut self,
node_id: &XorName,
operation_id: OperationId
) -> bool
pub fn request_operation_fulfilled(
&mut self,
node_id: &XorName,
operation_id: OperationId
) -> bool
Removes a pending_operation
from the node liveness records. Returns true if a record was removed
sourcepub fn dkg_ack_fulfilled(&mut self, node_id: &XorName)
pub fn dkg_ack_fulfilled(&mut self, node_id: &XorName)
Removes a DKG session from the node liveness records.
sourcepub fn ae_update_msg_received(&mut self, node_id: &XorName)
pub fn ae_update_msg_received(&mut self, node_id: &XorName)
Removes a probe tracker from the node liveness records.
sourcepub fn get_unfulfilled_ops(&self, node: XorName) -> Vec<OperationId> ⓘ
pub fn get_unfulfilled_ops(&self, node: XorName) -> Vec<OperationId> ⓘ
Gets the unfulfilled operation IDs for a given node.
This is for convenience, to wrap reading the concurrent data structure that stores the values.
If there are no unfulfilled operations tracked, an empty list will be returned.
sourcepub fn current_nodes(&self) -> &Vec<XorName> ⓘ
pub fn current_nodes(&self) -> &Vec<XorName> ⓘ
List all current tracked nodes
sourcepub fn add_new_node(&mut self, node: XorName)
pub fn add_new_node(&mut self, node: XorName)
Add a new node to the tracker and recompute closest nodes.
sourcepub fn retain_members_only(&mut self, current_members: BTreeSet<XorName>)
pub fn retain_members_only(&mut self, current_members: BTreeSet<XorName>)
Removes tracked nodes not present in current_members
.
Tracked issues related to nodes that were removed will also be removed.
Trait Implementations§
source§impl Clone for DysfunctionDetection
impl Clone for DysfunctionDetection
source§fn clone(&self) -> DysfunctionDetection
fn clone(&self) -> DysfunctionDetection
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for DysfunctionDetection
impl Send for DysfunctionDetection
impl Sync for DysfunctionDetection
impl Unpin for DysfunctionDetection
impl UnwindSafe for DysfunctionDetection
Blanket Implementations§
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
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>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds. Read more§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds. Read more§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds. Read more§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more