mod agreement;
mod join;
mod join_as_relocated;
mod node_msgs;
mod relocation;
mod section;
mod signed;
use crate::messaging::{EndUser, MessageId, SectionAuthorityProvider};
pub use agreement::{DkgFailureSig, DkgFailureSigSet, DkgSessionId, Proposal, SectionAuth};
use bls_dkg::key_gen::message::Message as DkgMessage;
use bytes::Bytes;
pub use join::{JoinRejectionReason, JoinRequest, JoinResponse, ResourceProofResponse};
pub use join_as_relocated::{JoinAsRelocatedRequest, JoinAsRelocatedResponse};
pub use node_msgs::{NodeCmd, NodeQuery, NodeQueryResponse};
pub use relocation::{RelocateDetails, RelocatePayload, RelocatePromise};
pub use section::MembershipState;
pub use section::NodeState;
use secured_linked_list::SecuredLinkedList;
use serde::{Deserialize, Serialize};
pub use signed::{KeyedSig, SigShare};
use std::{
collections::{BTreeMap, BTreeSet},
net::SocketAddr,
};
use xor_name::{Prefix, XorName};
use super::authority::SectionAuth as SectionAuthProof;
use super::AuthorityProof;
#[derive(Clone, PartialEq, Serialize, Deserialize, custom_debug::Debug)]
#[allow(clippy::large_enum_variant)]
pub enum SystemMsg {
AntiEntropyRetry {
section_auth: SectionAuthorityProvider,
section_signed: KeyedSig,
proof_chain: SecuredLinkedList,
#[debug(skip)]
bounced_msg: Bytes,
},
AntiEntropyRedirect {
section_auth: SectionAuthorityProvider,
section_signed: KeyedSig,
section_chain: SecuredLinkedList,
#[debug(skip)]
bounced_msg: Bytes,
},
AntiEntropyUpdate {
section_auth: SectionAuthorityProvider,
section_signed: KeyedSig,
proof_chain: SecuredLinkedList,
members: Option<BTreeSet<SectionAuth<NodeState>>>,
},
AntiEntropyProbe(XorName),
BackPressure(LoadReport),
Relocate(RelocateDetails),
RelocatePromise(RelocatePromise),
JoinRequest(Box<JoinRequest>),
JoinResponse(Box<JoinResponse>),
JoinAsRelocatedRequest(Box<JoinAsRelocatedRequest>),
JoinAsRelocatedResponse(Box<JoinAsRelocatedResponse>),
DkgStart {
session_id: DkgSessionId,
prefix: Prefix,
elders: BTreeMap<XorName, SocketAddr>,
},
DkgSessionUnknown {
session_id: DkgSessionId,
message: DkgMessage,
},
DkgSessionInfo {
session_id: DkgSessionId,
prefix: Prefix,
elders: BTreeMap<XorName, SocketAddr>,
section_auth: AuthorityProof<SectionAuthProof>,
message_cache: Vec<DkgMessage>,
message: DkgMessage,
},
DkgMessage {
session_id: DkgSessionId,
message: DkgMessage,
},
DkgNotReady {
session_id: DkgSessionId,
message: DkgMessage,
},
DkgRetry {
message_history: Vec<DkgMessage>,
session_id: DkgSessionId,
message: DkgMessage,
},
DkgFailureObservation {
session_id: DkgSessionId,
sig: DkgFailureSig,
failed_participants: BTreeSet<XorName>,
},
DkgFailureAgreement(DkgFailureSigSet),
Propose {
proposal: Proposal,
sig_share: SigShare,
},
StartConnectivityTest(XorName),
NodeCmd(NodeCmd),
NodeQuery(NodeQuery),
NodeQueryResponse {
response: NodeQueryResponse,
correlation_id: MessageId,
user: EndUser,
},
NodeMsgError {
error: crate::messaging::data::Error,
correlation_id: MessageId,
},
}
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
pub struct LoadReport {
pub short_term: CpuLoad,
pub mid_term: CpuLoad,
pub long_term: CpuLoad,
}
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
pub struct CpuLoad {
pub low: bool,
pub moderate: bool,
pub high: bool,
pub very_high: bool,
pub critical: bool,
}