Trait CommandCustomHeader

Source
pub trait CommandCustomHeader: AsAny {
    // Required method
    fn to_map(&self) -> Option<HashMap<CheetahString, CheetahString>>;

    // Provided methods
    fn check_fields(&self) -> Result<(), Error> { ... }
    fn write_if_not_null(&self, out: &mut BytesMut, key: &str, value: &str) { ... }
    fn encode_fast(&mut self, _out: &mut BytesMut) { ... }
    fn decode_fast(
        &mut self,
        _fields: &HashMap<CheetahString, CheetahString>,
    ) -> RocketMQResult<()> { ... }
    fn support_fast_codec(&self) -> bool { ... }
    fn get_and_check_not_none(
        &self,
        map: &HashMap<CheetahString, CheetahString>,
        field: &CheetahString,
    ) -> RocketMQResult<CheetahString> { ... }
}

Required Methods§

Source

fn to_map(&self) -> Option<HashMap<CheetahString, CheetahString>>

Converts the implementing type to a map.

Returns an Option that contains a HashMap of string keys and string values,
representing the implementing type’s fields.
If the conversion is successful, a non-empty map is returned.
If the conversion fails, None is returned.

Provided Methods§

Source

fn check_fields(&self) -> Result<(), Error>

Checks the fields of the implementing type.

Returns a Result indicating whether the fields are valid or not.
If the fields are valid, the Ok variant is returned with an empty () value.
If the fields are invalid, an Err variant is returned with an associated Error value.

Source

fn write_if_not_null(&self, out: &mut BytesMut, key: &str, value: &str)

Writes the provided key to the out buffer if the value is not empty.

§Arguments
  • out - A mutable reference to a BytesMut buffer where the key will be written.
  • key - A string slice that represents the key to be written.
  • value - A string slice that represents the value associated with the key.
§Behavior

If value is not empty, the function will write the key to the out buffer twice, first with a short length prefix and then with a long length prefix.

Source

fn encode_fast(&mut self, _out: &mut BytesMut)

A placeholder function for fast encoding.

This function currently does nothing and can be overridden by implementing types.

Source

fn decode_fast( &mut self, _fields: &HashMap<CheetahString, CheetahString>, ) -> RocketMQResult<()>

A placeholder function for fast decoding.

This function currently does nothing and can be overridden by implementing types.

§Arguments
  • _fields - A reference to a HashMap that contains the fields to be decoded.
Source

fn support_fast_codec(&self) -> bool

Indicates whether the implementing type supports fast codec.

§Returns

This function returns false by default, indicating that the implementing type does not support fast codec. This can be overridden by implementing types.

Source

fn get_and_check_not_none( &self, map: &HashMap<CheetahString, CheetahString>, field: &CheetahString, ) -> RocketMQResult<CheetahString>

Retrieves the value associated with the specified field from the provided map.

§Arguments
  • map - A reference to a HashMap containing CheetahString keys and values.
  • field - A reference to a CheetahString representing the field to retrieve.
§Returns
  • Ok(CheetahString) - If the field is found in the map, returns the associated value.
  • Err(RocketmqError::DeserializeHeaderError) - If the field is not found in the map, returns an error indicating the field is required.
§Errors

This function returns a RocketmqError::DeserializeHeaderError if the specified field is not found in the map.

Implementors§

Source§

impl CommandCustomHeader for RpcRequestHeader

Source§

impl CommandCustomHeader for rocketmq_remoting::rpc::topic_request_header::TopicRequestHeader

Source§

impl CommandCustomHeader for AckMessageRequestHeader

Source§

impl CommandCustomHeader for rocketmq_remoting::protocol::header::broker::broker_heartbeat_request_header::BrokerHeartbeatRequestHeader

Source§

impl CommandCustomHeader for ChangeInvisibleTimeRequestHeader

Source§

impl CommandCustomHeader for ChangeInvisibleTimeResponseHeader

Source§

impl CommandCustomHeader for CheckTransactionStateRequestHeader

Source§

impl CommandCustomHeader for GetRouteInfoRequestHeader

Source§

impl CommandCustomHeader for ConsumeMessageDirectlyResultRequestHeader

Source§

impl CommandCustomHeader for ConsumerSendMsgBackRequestHeader

Source§

impl CommandCustomHeader for CreateTopicRequestHeader

Source§

impl CommandCustomHeader for DeleteSubscriptionGroupRequestHeader

Source§

impl CommandCustomHeader for DeleteTopicRequestHeader

Source§

impl CommandCustomHeader for ElectMasterResponseHeader

Source§

impl CommandCustomHeader for EmptyHeader

Source§

impl CommandCustomHeader for EndTransactionRequestHeader

Source§

impl CommandCustomHeader for GetConsumeStatsRequestHeader

Source§

impl CommandCustomHeader for GetConsumerConnectionListRequestHeader

Source§

impl CommandCustomHeader for GetConsumerListByGroupRequestHeader

Source§

impl CommandCustomHeader for GetConsumerRunningInfoRequestHeader

Source§

impl CommandCustomHeader for GetEarliestMsgStoretimeResponseHeader

Source§

impl CommandCustomHeader for GetMaxOffsetRequestHeader

Source§

impl CommandCustomHeader for GetMaxOffsetResponseHeader

Source§

impl CommandCustomHeader for GetMetaDataResponseHeader

Source§

impl CommandCustomHeader for GetMinOffsetRequestHeader

Source§

impl CommandCustomHeader for GetMinOffsetResponseHeader

Source§

impl CommandCustomHeader for GetTopicConfigRequestHeader

Source§

impl CommandCustomHeader for GetTopicStatsInfoRequestHeader

Source§

impl CommandCustomHeader for GetTopicStatsRequestHeader

Source§

impl CommandCustomHeader for HeartbeatRequestHeader

Source§

impl CommandCustomHeader for LockBatchMqRequestHeader

Source§

impl CommandCustomHeader for SendMessageRequestHeader

Source§

impl CommandCustomHeader for SendMessageRequestHeaderV2

Source§

impl CommandCustomHeader for SendMessageResponseHeader

Source§

impl CommandCustomHeader for rocketmq_remoting::protocol::header::namesrv::broker_request::BrokerHeartbeatRequestHeader

Source§

impl CommandCustomHeader for GetBrokerMemberGroupRequestHeader

Source§

impl CommandCustomHeader for UnRegisterBrokerRequestHeader

Source§

impl CommandCustomHeader for NotifyMinBrokerIdChangeRequestHeader

Source§

impl CommandCustomHeader for DeleteKVConfigRequestHeader

Source§

impl CommandCustomHeader for GetKVConfigRequestHeader

Source§

impl CommandCustomHeader for GetKVConfigResponseHeader

Source§

impl CommandCustomHeader for GetKVListByNamespaceRequestHeader

Source§

impl CommandCustomHeader for PutKVConfigRequestHeader

Source§

impl CommandCustomHeader for AddWritePermOfBrokerRequestHeader

Source§

impl CommandCustomHeader for AddWritePermOfBrokerResponseHeader

Source§

impl CommandCustomHeader for WipeWritePermOfBrokerRequestHeader

Source§

impl CommandCustomHeader for WipeWritePermOfBrokerResponseHeader

Source§

impl CommandCustomHeader for QueryDataVersionRequestHeader

Source§

impl CommandCustomHeader for QueryDataVersionResponseHeader

Source§

impl CommandCustomHeader for RegisterBrokerRequestHeader

Source§

impl CommandCustomHeader for RegisterBrokerResponseHeader

Source§

impl CommandCustomHeader for DeleteTopicFromNamesrvRequestHeader

Source§

impl CommandCustomHeader for GetTopicsByClusterRequestHeader

Source§

impl CommandCustomHeader for RegisterTopicRequestHeader

Source§

impl CommandCustomHeader for rocketmq_remoting::protocol::header::namesrv::topic_operation_header::TopicRequestHeader

Source§

impl CommandCustomHeader for NotificationRequestHeader

Source§

impl CommandCustomHeader for NotificationResponseHeader

Source§

impl CommandCustomHeader for NotifyConsumerIdsChangedRequestHeader

Source§

impl CommandCustomHeader for PopMessageRequestHeader

Source§

impl CommandCustomHeader for PopMessageResponseHeader

Source§

impl CommandCustomHeader for PullMessageRequestHeader

Source§

impl CommandCustomHeader for PullMessageResponseHeader

Source§

impl CommandCustomHeader for QueryConsumeTimeSpanRequestHeader

Source§

impl CommandCustomHeader for QueryConsumerOffsetRequestHeader

Source§

impl CommandCustomHeader for QueryConsumerOffsetResponseHeader

Source§

impl CommandCustomHeader for QueryMessageRequestHeader

Source§

impl CommandCustomHeader for QueryMessageResponseHeader

Source§

impl CommandCustomHeader for QuerySubscriptionByConsumerRequestHeader

Source§

impl CommandCustomHeader for QueryTopicConsumeByWhoRequestHeader

Source§

impl CommandCustomHeader for QueryTopicsByConsumerRequestHeader

Source§

impl CommandCustomHeader for ReplyMessageRequestHeader

Source§

impl CommandCustomHeader for ResetOffsetRequestHeader

Source§

impl CommandCustomHeader for SearchOffsetResponseHeader

Source§

impl CommandCustomHeader for UnlockBatchMqRequestHeader

Source§

impl CommandCustomHeader for UnregisterClientRequestHeader

Source§

impl CommandCustomHeader for UpdateConsumerOffsetRequestHeader

Source§

impl CommandCustomHeader for UpdateConsumerOffsetResponseHeader

Source§

impl CommandCustomHeader for ViewMessageRequestHeader