pub struct Endpoint {
role: Role,
session: SessionStateMachine,
request_ids: RequestIdAllocator,
subscriptions: HashMap<u64, SubscriptionStateMachine>,
fetches: HashMap<u64, FetchStateMachine>,
subscribe_namespaces: HashMap<u64, SubscribeNamespaceStateMachine>,
publish_namespaces: HashMap<u64, PublishNamespaceStateMachine>,
negotiated_version: Option<VarInt>,
offered_versions: Vec<VarInt>,
goaway_uri: Option<Vec<u8>>,
}Expand description
Unified MoQT endpoint wrapping session lifecycle, request ID allocation, and all per-request state machines (subscriptions, fetches, namespaces).
Fields§
§role: Role§session: SessionStateMachine§request_ids: RequestIdAllocator§subscriptions: HashMap<u64, SubscriptionStateMachine>§fetches: HashMap<u64, FetchStateMachine>§subscribe_namespaces: HashMap<u64, SubscribeNamespaceStateMachine>§publish_namespaces: HashMap<u64, PublishNamespaceStateMachine>§negotiated_version: Option<VarInt>§offered_versions: Vec<VarInt>§goaway_uri: Option<Vec<u8>>Implementations§
Source§impl Endpoint
impl Endpoint
pub fn role(&self) -> Role
pub fn session_state(&self) -> SessionState
pub fn negotiated_version(&self) -> Option<VarInt>
pub fn goaway_uri(&self) -> Option<&[u8]>
pub fn is_blocked(&self) -> bool
pub fn active_subscription_count(&self) -> usize
pub fn active_fetch_count(&self) -> usize
pub fn active_subscribe_namespace_count(&self) -> usize
pub fn active_publish_namespace_count(&self) -> usize
Sourcepub fn connect(&mut self) -> Result<(), EndpointError>
pub fn connect(&mut self) -> Result<(), EndpointError>
Transition from Connecting to SetupExchange.
Sourcepub fn close(&mut self) -> Result<(), EndpointError>
pub fn close(&mut self) -> Result<(), EndpointError>
Close the session (Active or Draining -> Closed).
Sourcepub fn send_client_setup(
&mut self,
versions: Vec<VarInt>,
) -> Result<ControlMessage, EndpointError>
pub fn send_client_setup( &mut self, versions: Vec<VarInt>, ) -> Result<ControlMessage, EndpointError>
Generate a CLIENT_SETUP message (client-side).
Sourcepub fn receive_server_setup(
&mut self,
msg: &ServerSetup,
) -> Result<(), EndpointError>
pub fn receive_server_setup( &mut self, msg: &ServerSetup, ) -> Result<(), EndpointError>
Process a SERVER_SETUP message (client-side). Transitions to Active.
Sourcepub fn receive_client_setup_and_respond(
&mut self,
client_setup: &ClientSetup,
selected_version: VarInt,
) -> Result<ControlMessage, EndpointError>
pub fn receive_client_setup_and_respond( &mut self, client_setup: &ClientSetup, selected_version: VarInt, ) -> Result<ControlMessage, EndpointError>
Process CLIENT_SETUP and generate SERVER_SETUP (server-side).
Sourcepub fn receive_max_request_id(
&mut self,
msg: &MaxRequestIdMsg,
) -> Result<(), EndpointError>
pub fn receive_max_request_id( &mut self, msg: &MaxRequestIdMsg, ) -> Result<(), EndpointError>
Process an incoming MAX_REQUEST_ID message.
Sourcepub fn send_max_request_id(
&mut self,
max_id: VarInt,
) -> Result<ControlMessage, EndpointError>
pub fn send_max_request_id( &mut self, max_id: VarInt, ) -> Result<ControlMessage, EndpointError>
Generate a MAX_REQUEST_ID message (typically server-side).
Sourcepub fn receive_goaway(&mut self, msg: &GoAway) -> Result<(), EndpointError>
pub fn receive_goaway(&mut self, msg: &GoAway) -> Result<(), EndpointError>
Process an incoming GOAWAY message. Transitions to Draining.
fn require_active_or_err(&self) -> Result<(), EndpointError>
Sourcepub fn subscribe(
&mut self,
track_namespace: TrackNamespace,
track_name: Vec<u8>,
subscriber_priority: u8,
group_order: GroupOrder,
filter_type: FilterType,
) -> Result<(VarInt, ControlMessage), EndpointError>
pub fn subscribe( &mut self, track_namespace: TrackNamespace, track_name: Vec<u8>, subscriber_priority: u8, group_order: GroupOrder, filter_type: FilterType, ) -> Result<(VarInt, ControlMessage), EndpointError>
Send a SUBSCRIBE message. Allocates a request ID and creates a subscription state machine.
Sourcepub fn receive_subscribe_ok(
&mut self,
msg: &SubscribeOk,
) -> Result<(), EndpointError>
pub fn receive_subscribe_ok( &mut self, msg: &SubscribeOk, ) -> Result<(), EndpointError>
Process an incoming SUBSCRIBE_OK.
Sourcepub fn receive_subscribe_error(
&mut self,
msg: &SubscribeError,
) -> Result<(), EndpointError>
pub fn receive_subscribe_error( &mut self, msg: &SubscribeError, ) -> Result<(), EndpointError>
Process an incoming SUBSCRIBE_ERROR.
Sourcepub fn unsubscribe(
&mut self,
request_id: VarInt,
) -> Result<ControlMessage, EndpointError>
pub fn unsubscribe( &mut self, request_id: VarInt, ) -> Result<ControlMessage, EndpointError>
Send an UNSUBSCRIBE message for an active subscription.
Sourcepub fn receive_publish_done(
&mut self,
msg: &PublishDone,
) -> Result<(), EndpointError>
pub fn receive_publish_done( &mut self, msg: &PublishDone, ) -> Result<(), EndpointError>
Process an incoming PUBLISH_DONE.
Sourcepub fn fetch(
&mut self,
track_namespace: TrackNamespace,
track_name: Vec<u8>,
start_group: VarInt,
start_object: VarInt,
) -> Result<(VarInt, ControlMessage), EndpointError>
pub fn fetch( &mut self, track_namespace: TrackNamespace, track_name: Vec<u8>, start_group: VarInt, start_object: VarInt, ) -> Result<(VarInt, ControlMessage), EndpointError>
Send a FETCH message. Allocates a request ID and creates a fetch state machine.
Sourcepub fn receive_fetch_ok(&mut self, msg: &FetchOk) -> Result<(), EndpointError>
pub fn receive_fetch_ok(&mut self, msg: &FetchOk) -> Result<(), EndpointError>
Process an incoming FETCH_OK.
Sourcepub fn receive_fetch_error(
&mut self,
msg: &FetchError,
) -> Result<(), EndpointError>
pub fn receive_fetch_error( &mut self, msg: &FetchError, ) -> Result<(), EndpointError>
Process an incoming FETCH_ERROR.
Sourcepub fn fetch_cancel(
&mut self,
request_id: VarInt,
) -> Result<ControlMessage, EndpointError>
pub fn fetch_cancel( &mut self, request_id: VarInt, ) -> Result<ControlMessage, EndpointError>
Send a FETCH_CANCEL message.
Sourcepub fn on_fetch_stream_fin(
&mut self,
request_id: VarInt,
) -> Result<(), EndpointError>
pub fn on_fetch_stream_fin( &mut self, request_id: VarInt, ) -> Result<(), EndpointError>
Notify that a fetch data stream received FIN.
Sourcepub fn on_fetch_stream_reset(
&mut self,
request_id: VarInt,
) -> Result<(), EndpointError>
pub fn on_fetch_stream_reset( &mut self, request_id: VarInt, ) -> Result<(), EndpointError>
Notify that a fetch data stream was reset.
Sourcepub fn subscribe_namespace(
&mut self,
track_namespace: TrackNamespace,
) -> Result<(VarInt, ControlMessage), EndpointError>
pub fn subscribe_namespace( &mut self, track_namespace: TrackNamespace, ) -> Result<(VarInt, ControlMessage), EndpointError>
Send a SUBSCRIBE_NAMESPACE message.
Sourcepub fn receive_subscribe_namespace_ok(
&mut self,
msg: &SubscribeNamespaceOk,
) -> Result<(), EndpointError>
pub fn receive_subscribe_namespace_ok( &mut self, msg: &SubscribeNamespaceOk, ) -> Result<(), EndpointError>
Process an incoming SUBSCRIBE_NAMESPACE_OK.
Sourcepub fn receive_subscribe_namespace_error(
&mut self,
msg: &SubscribeNamespaceError,
) -> Result<(), EndpointError>
pub fn receive_subscribe_namespace_error( &mut self, msg: &SubscribeNamespaceError, ) -> Result<(), EndpointError>
Process an incoming SUBSCRIBE_NAMESPACE_ERROR.
Sourcepub fn unsubscribe_namespace(
&mut self,
request_id: VarInt,
track_namespace: TrackNamespace,
) -> Result<ControlMessage, EndpointError>
pub fn unsubscribe_namespace( &mut self, request_id: VarInt, track_namespace: TrackNamespace, ) -> Result<ControlMessage, EndpointError>
Send an UNSUBSCRIBE_NAMESPACE message.
Sourcepub fn publish_namespace(
&mut self,
track_namespace: TrackNamespace,
) -> Result<(VarInt, ControlMessage), EndpointError>
pub fn publish_namespace( &mut self, track_namespace: TrackNamespace, ) -> Result<(VarInt, ControlMessage), EndpointError>
Send a PUBLISH_NAMESPACE message.
Sourcepub fn receive_publish_namespace_ok(
&mut self,
msg: &PublishNamespaceOk,
) -> Result<(), EndpointError>
pub fn receive_publish_namespace_ok( &mut self, msg: &PublishNamespaceOk, ) -> Result<(), EndpointError>
Process an incoming PUBLISH_NAMESPACE_OK.
Sourcepub fn receive_publish_namespace_error(
&mut self,
msg: &PublishNamespaceError,
) -> Result<(), EndpointError>
pub fn receive_publish_namespace_error( &mut self, msg: &PublishNamespaceError, ) -> Result<(), EndpointError>
Process an incoming PUBLISH_NAMESPACE_ERROR.
Sourcepub fn receive_publish_namespace_done(
&mut self,
msg: &PublishNamespaceDone,
) -> Result<(), EndpointError>
pub fn receive_publish_namespace_done( &mut self, msg: &PublishNamespaceDone, ) -> Result<(), EndpointError>
Process an incoming PUBLISH_NAMESPACE_DONE.
Sourcepub fn publish_namespace_cancel(
&mut self,
request_id: VarInt,
reason_phrase: Vec<u8>,
) -> Result<ControlMessage, EndpointError>
pub fn publish_namespace_cancel( &mut self, request_id: VarInt, reason_phrase: Vec<u8>, ) -> Result<ControlMessage, EndpointError>
Send a PUBLISH_NAMESPACE_CANCEL message.
Sourcepub fn receive_message(
&mut self,
msg: ControlMessage,
) -> Result<(), EndpointError>
pub fn receive_message( &mut self, msg: ControlMessage, ) -> Result<(), EndpointError>
Dispatch an incoming control message to the appropriate handler.