pub struct MessageSendTracker { /* private fields */ }
Expand description
You probably don’t want to create one of these directly, but instead use |SequenceServer| to create one for you and then get a reference to it from |SequenceServer.get_message_tracker|.
Server components can use this to help manage sending batons to clients at appropriate times. Server components should call |message_sent| when they send a message to a client. Servers should call |set_requester| whenever server receives a hanging-GET for a baton from a client.
Implementations§
Source§impl MessageSendTracker
impl MessageSendTracker
pub async fn new(sag: ActivityGovernorProxy) -> Self
Sourcepub async fn message_sent(&mut self) -> Result<(), MessageTrackerError>
pub async fn message_sent(&mut self) -> Result<(), MessageTrackerError>
Inform the tracker a message was sent, equivalent to |messages_sent(1)|. If the system is suspended, a wake lease is taken to guarantee the message can be processed. This is the behavior we probably want if we this message came from a waking interrupt. This means after this function returns, the caller can safely ack an interrupt related to this event.
Sourcepub async fn messages_sent(
&mut self,
message_count: u64,
) -> Result<(), MessageTrackerError>
pub async fn messages_sent( &mut self, message_count: u64, ) -> Result<(), MessageTrackerError>
Inform the tracker that |message_count| messages were sent. If the system is suspended, a wake lease is taken to guarantee the message can be processed. This is the behavior we probably want if we this message came from a waking interrupt. This means after this function returns, the caller can safely ack an interrupt related to this event.
Sourcepub fn set_requester(&mut self, requester: MessageSourceReceiveBatonResponder)
pub fn set_requester(&mut self, requester: MessageSourceReceiveBatonResponder)
Deposits a request for a baton that a client made. This is a hanging-GET-style communication pattern and so the client receives a response the next time a flush is triggered. If a flush was triggered before |set_requester| was called, the baton is sent now based on the current message index.