pub struct BrokerMessage { /* private fields */ }Expand description
Broker internal message representation
Contains extension information needed by the Broker when processing messages, such as tags_code, encoding cache, etc. Only used internally by the Broker, not exposed to clients.
§Use Cases
- Broker receives messages and constructs BrokerMessage for writing to CommitLog
- Store module internal message passing
- Message filtering and index building
Implementations§
Source§impl BrokerMessage
impl BrokerMessage
Sourcepub fn new(
envelope: MessageEnvelope,
tags_code: i64,
properties_string: CheetahString,
version: MessageVersion,
) -> Self
pub fn new( envelope: MessageEnvelope, tags_code: i64, properties_string: CheetahString, version: MessageVersion, ) -> Self
Creates a new broker message
Sourcepub fn from_envelope(envelope: MessageEnvelope) -> Self
pub fn from_envelope(envelope: MessageEnvelope) -> Self
Creates from message envelope (automatically calculates tags_code and properties_string)
Sourcepub fn envelope(&self) -> &MessageEnvelope
pub fn envelope(&self) -> &MessageEnvelope
Gets the message envelope
Sourcepub fn envelope_mut(&mut self) -> &mut MessageEnvelope
pub fn envelope_mut(&mut self) -> &mut MessageEnvelope
Gets the mutable message envelope
Sourcepub fn into_envelope(self) -> MessageEnvelope
pub fn into_envelope(self) -> MessageEnvelope
Consumes self and returns the envelope
Gets the tags hash code
Sourcepub fn properties_string(&self) -> &str
pub fn properties_string(&self) -> &str
Gets the serialized properties string
Sourcepub fn version(&self) -> MessageVersion
pub fn version(&self) -> MessageVersion
Gets the message version
Sourcepub fn encoded_buff(&self) -> Option<&BytesMut>
pub fn encoded_buff(&self) -> Option<&BytesMut>
Gets the encoding cache
Sourcepub fn encoded_buff_mut(&mut self) -> Option<&mut BytesMut>
pub fn encoded_buff_mut(&mut self) -> Option<&mut BytesMut>
Gets the mutable encoding cache
Sourcepub fn is_encode_completed(&self) -> bool
pub fn is_encode_completed(&self) -> bool
Checks if encoding is completed
Sourcepub fn set_encoded_buff(&mut self, buff: BytesMut)
pub fn set_encoded_buff(&mut self, buff: BytesMut)
Sets the encoding cache
Sourcepub fn take_encoded_buff(&mut self) -> Option<BytesMut>
pub fn take_encoded_buff(&mut self) -> Option<BytesMut>
Takes the encoding cache
Sourcepub fn clear_encoded_buff(&mut self)
pub fn clear_encoded_buff(&mut self)
Clears the encoding cache
Sourcepub fn set_version(&mut self, version: MessageVersion)
pub fn set_version(&mut self, version: MessageVersion)
Sets the message version
Sets the tags code
Sourcepub fn set_properties_string(&mut self, properties_string: CheetahString)
pub fn set_properties_string(&mut self, properties_string: CheetahString)
Sets the properties string
Calculates the hash code for tags
Sourcepub fn delete_property(&mut self, name: &str)
pub fn delete_property(&mut self, name: &str)
Deletes a property (synchronizes properties_string)
Sourcepub fn property(&self, name: &str) -> Option<CheetahString>
pub fn property(&self, name: &str) -> Option<CheetahString>
Gets a property value