pub struct CellMessage {
pub message_id: String,
pub seq: SequenceNumber,
pub sender: String,
pub squad_id: String,
pub priority: MessagePriority,
pub routing_context: RoutingContext,
pub payload: CellMessageType,
pub timestamp: u64,
pub ttl: u64,
}Expand description
Cell message envelope
Fields§
§message_id: StringMessage ID (unique per sender)
seq: SequenceNumberSequence number for ordering
sender: StringSender platform ID
squad_id: StringTarget squad ID
priority: MessagePriorityMessage priority
routing_context: RoutingContextRouting context (for hierarchical priority escalation)
payload: CellMessageTypeMessage payload
timestamp: u64Timestamp (Unix seconds)
ttl: u64Time-to-live (seconds)
Implementations§
Source§impl CellMessage
impl CellMessage
Sourcepub fn new(
sender: String,
squad_id: String,
seq: SequenceNumber,
payload: CellMessageType,
) -> Self
pub fn new( sender: String, squad_id: String, seq: SequenceNumber, payload: CellMessageType, ) -> Self
Create a new squad message (defaults to intra-cell routing)
Sourcepub fn with_priority(self, priority: MessagePriority) -> Self
pub fn with_priority(self, priority: MessagePriority) -> Self
Create a message with custom priority
Sourcepub fn with_routing_context(self, context: RoutingContext) -> Self
pub fn with_routing_context(self, context: RoutingContext) -> Self
Create a message with custom routing context
Sourcepub fn escalate_priority(&mut self)
pub fn escalate_priority(&mut self)
Escalate message priority based on routing context
This should be called when a message crosses hierarchy boundaries. For example, when a cell leader forwards a message to zone level.
Sourcepub fn effective_priority(&self) -> MessagePriority
pub fn effective_priority(&self) -> MessagePriority
Get the effective priority after escalation
Returns what the priority would be if escalated, without modifying the message.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if message has expired
Sourcepub fn role_assignment(
sender: String,
squad_id: String,
seq: SequenceNumber,
platform_id: String,
role: CellRole,
score: f64,
is_primary: bool,
) -> Self
pub fn role_assignment( sender: String, squad_id: String, seq: SequenceNumber, platform_id: String, role: CellRole, score: f64, is_primary: bool, ) -> Self
Create a role assignment message
Trait Implementations§
Source§impl Clone for CellMessage
impl Clone for CellMessage
Source§fn clone(&self) -> CellMessage
fn clone(&self) -> CellMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CellMessage
impl Debug for CellMessage
Source§impl<'de> Deserialize<'de> for CellMessage
impl<'de> Deserialize<'de> for CellMessage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CellMessage
impl RefUnwindSafe for CellMessage
impl Send for CellMessage
impl Sync for CellMessage
impl Unpin for CellMessage
impl UnsafeUnpin for CellMessage
impl UnwindSafe for CellMessage
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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