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 (REQUEST_OK written on the peer’s stream).
Draft-18 folded PUBLISH_OK into REQUEST_OK and draft-19 keeps it that way, so the message that walks this edge is a REQUEST_OK here where on draft-17 it was a PUBLISH_OK of its own.
Sourcepub fn on_publish_error_sent(&mut self) -> Result<(), PublishFlowError>
pub fn on_publish_error_sent(&mut self) -> Result<(), PublishFlowError>
Publishing -> Done (REQUEST_ERROR written on the peer’s stream).
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 publishing peer).
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 (REQUEST_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).
Sourcepub fn on_request_cancelled(&mut self) -> Result<(), PublishError>
pub fn on_request_cancelled(&mut self) -> Result<(), PublishError>
Publishing | Active -> Done, Done -> Done (this request’s stream was cancelled).
PUBLISH_DONE ends a publication the receiver accepted. This is the request itself being withdrawn, which this draft puts at the stream — Section 3.3.3: “Once a request stream has been opened, the request MAY be cancelled by either endpoint.”
Idle is refused, on the other half of the same sentence: nothing has
been written, so there is no stream to terminate. Done stays Done —
nothing finishes a request stream’s send half on the ordinary path, so a
caller that walks away from a request that has already ended still
resets the stream, and that reset is an ordinary end rather than a
fault.