pub struct PublishStateMachine {
state: PublishState,
}Expand description
Pure state machine for a MoQT publish request (publisher side). Transitions: Idle → Publishing → Active → Done.
Fields§
§state: PublishStateImplementations§
Source§impl PublishStateMachine
impl PublishStateMachine
Sourcepub fn on_publish_received(&mut self) -> Result<(), PublishFlowError>
pub fn on_publish_received(&mut self) -> Result<(), PublishFlowError>
Idle -> Publishing (PUBLISH received from the peer).
Sourcepub fn on_publish_ok_sent(&mut self) -> Result<(), PublishFlowError>
pub fn on_publish_ok_sent(&mut self) -> Result<(), PublishFlowError>
Publishing -> Active (PUBLISH_OK sent to the offering peer).
Sourcepub fn on_publish_error_sent(&mut self) -> Result<(), PublishFlowError>
pub fn on_publish_error_sent(&mut self) -> Result<(), PublishFlowError>
Publishing -> Done (PUBLISH_ERROR sent to the offering peer).
Sourcepub fn on_publish_done_received(&mut self) -> Result<(), PublishFlowError>
pub fn on_publish_done_received(&mut self) -> Result<(), PublishFlowError>
Active -> Done (PUBLISH_DONE received from the offering peer).
Sourcepub fn on_unsubscribe_sent(&mut self) -> Result<(), PublishFlowError>
pub fn on_unsubscribe_sent(&mut self) -> Result<(), PublishFlowError>
Active -> Done (UNSUBSCRIBE sent to the offering peer).
The same transition as the one above and a separate name, because a refusal has to say which of the two events was refused.
Sourcepub fn on_unsubscribe_received(&mut self) -> Result<(), PublishFlowError>
pub fn on_unsubscribe_received(&mut self) -> Result<(), PublishFlowError>
Active -> Done (UNSUBSCRIBE received from the subscribing peer).
The mirror of the one above, on an offer this endpoint made rather than one it took. Both directions are held in this one map, so the event name is the only thing that says which of them was refused.
Source§impl PublishStateMachine
impl PublishStateMachine
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new state machine in the PublishState::Idle state.
Sourcepub fn state(&self) -> PublishState
pub fn state(&self) -> PublishState
Returns the current state of the publish request.
Sourcepub fn on_publish_sent(&mut self) -> Result<(), PublishError>
pub fn on_publish_sent(&mut self) -> Result<(), PublishError>
Idle → Publishing (PUBLISH sent).
Sourcepub fn on_publish_ok(&mut self) -> Result<(), PublishError>
pub fn on_publish_ok(&mut self) -> Result<(), PublishError>
Publishing → Active (PUBLISH_OK received).
Sourcepub fn on_publish_error(&mut self) -> Result<(), PublishError>
pub fn on_publish_error(&mut self) -> Result<(), PublishError>
Publishing → Done (PUBLISH_ERROR received).
Sourcepub fn on_publish_done_sent(&mut self) -> Result<(), PublishError>
pub fn on_publish_done_sent(&mut self) -> Result<(), PublishError>
Active → Done (PUBLISH_DONE sent by publisher).