pub struct MeshCoordinator { /* private fields */ }Expand description
Tracks peer assessment states and handles mesh protocol messages.
Lives inside AssessmentService (behind Option) and is only
active when [mesh] enabled = true in the project config.
Implementations§
Source§impl MeshCoordinator
impl MeshCoordinator
Sourcepub fn new(node_id: String, project_name: String) -> Self
pub fn new(node_id: String, project_name: String) -> Self
Create a new coordinator for the given node and project.
Sourcepub fn handle_message(
&self,
msg: AssessmentMessage,
) -> Option<AssessmentMessage>
pub fn handle_message( &self, msg: AssessmentMessage, ) -> Option<AssessmentMessage>
Process an incoming mesh message, optionally returning a response.
Gossipupdates peer state, no response.ReportAvailableupdates peer state, no response.RequestReportreturns nothing here (caller should checkAssessmentService::get_latest()and build aFullReport).FullReportis handled by the caller (store the report).
Sourcepub fn build_gossip(&self, report: &AssessmentReport) -> AssessmentMessage
pub fn build_gossip(&self, report: &AssessmentReport) -> AssessmentMessage
Build a gossip message from the latest assessment report.
Sourcepub fn build_broadcast(&self, report: &AssessmentReport) -> AssessmentMessage
pub fn build_broadcast(&self, report: &AssessmentReport) -> AssessmentMessage
Build a ReportAvailable broadcast from the latest report.
Sourcepub fn build_finding_diff(
&self,
report: &AssessmentReport,
diff: &AssessmentDiff,
) -> AssessmentMessage
pub fn build_finding_diff( &self, report: &AssessmentReport, diff: &AssessmentDiff, ) -> AssessmentMessage
Build a FindingDiff push from an AssessmentDiff (changed findings only).
Sourcepub fn peer_states(&self) -> Vec<PeerAssessmentState>
pub fn peer_states(&self) -> Vec<PeerAssessmentState>
Return a snapshot of all known peer assessment states.
Sourcepub fn update_peer(&self, state: PeerAssessmentState)
pub fn update_peer(&self, state: PeerAssessmentState)
Store or update a peer’s assessment state.
Sourcepub fn set_pending_broadcast(&self, msg: AssessmentMessage)
pub fn set_pending_broadcast(&self, msg: AssessmentMessage)
Store a pending broadcast message for the daemon to pick up.
Sourcepub fn take_pending_broadcast(&self) -> Option<AssessmentMessage>
pub fn take_pending_broadcast(&self) -> Option<AssessmentMessage>
Take the pending broadcast (returns None if already consumed).
Sourcepub fn project_name(&self) -> &str
pub fn project_name(&self) -> &str
This node’s project name.
Auto Trait Implementations§
impl !Freeze for MeshCoordinator
impl RefUnwindSafe for MeshCoordinator
impl Send for MeshCoordinator
impl Sync for MeshCoordinator
impl Unpin for MeshCoordinator
impl UnsafeUnpin for MeshCoordinator
impl UnwindSafe for MeshCoordinator
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