LibQuicR
quicr::TrackStatusHandler Class Reference

Represents one reusable TRACK_STATUS request. More...

#include <track_status_handler.h>

Inheritance diagram for quicr::TrackStatusHandler:
quicr::TrackHandler

Public Types

enum class  Status : std::uint8_t {
  kNotRequested , kPendingResponse , kOk , kError ,
  kDoneByFin , kDoneByReset , kNotConnected
}
 Lifecycle state of the most recent query. More...
 

Public Member Functions

Status GetStatus () const
 
std::optional< TrackStatusResponse > GetResponse () const
 
std::optional< Error< ErrorCode > > GetError () const
 
virtual void StatusChanged (Status status)
 Reports completion with kOk or kError. More...
 
template<typename T >
requires std::is_base_of_v< TrackHandler, T > std::shared_ptr< T > Get ()
 Get the derived type of the track handler. More...
 
void SetRequestId (std::optional< uint64_t > request_id)
 Sets or clears the connection-scoped request ID. More...
 
std::optional< uint64_t > GetRequestId () const noexcept
 Get the request ID. More...
 
std::optional< uint64_t > GetRequestStreamId () const
 Get the stream ID of the request control stream. More...
 
FullTrackName GetFullTrackName () const noexcept
 Get the full track name. More...
 
uint64_t GetConnectionId () const noexcept
 Gets the transport connection identifier assigned by the session. More...
 
std::shared_ptr< Connection > GetConnection () const
 
Binding GetBinding () const
 

Static Public Member Functions

static std::shared_ptr< TrackStatusHandler > Create (const FullTrackName &full_track_name)
 Creates a track-status request handler. More...
 

Protected Member Functions

 TrackStatusHandler (const FullTrackName &full_track_name)
 Constructs an unsubmitted request for a track. More...
 
void RequestOkReceived (const messages::Parameters &params) override
 Rejects an impossible generic REQUEST_OK path. More...
 
void RequestError (ErrorCode error_code, std::string reason) override
 Records a peer rejection while a response is pending. More...
 
Reply< messages::Parameters, ErrorCode > RequestUpdateReceived (const messages::Parameters &params) override
 Rejects REQUEST_UPDATE for a TRACK_STATUS request. More...
 
void SetTransport (std::shared_ptr< Session > transport)
 Sets the session used for control and data operations. More...
 
const std::weak_ptr< Session > & GetSession () const noexcept
 Gets the non-owning session handle. More...
 

Protected Attributes

FullTrackName full_track_name_
 Full track identity retained for the handler's lifetime. More...
 
std::mutex binding_operation_mutex_
 

Detailed Description

Represents one reusable TRACK_STATUS request.

Pass the handler to Session::RequestTrackStatus. Getters are synchronized and may be called from other threads. StatusChanged is invoked on session processing paths after a response or error; stream-close and disconnect status changes currently do not invoke it. A completed handler may be submitted again, but not while a response is pending.

Member Enumeration Documentation

◆ Status

enum quicr::TrackStatusHandler::Status : std::uint8_t
strong

Lifecycle state of the most recent query.

Enumerator
kNotRequested 

Ready to be passed to Session.

kPendingResponse 

Waiting for response from the peer.

kOk 

Response received.

kError 

The peer rejected the query; GetError() contains its reason.

kDoneByFin 

The peer closed the stream without a response.

kDoneByReset 

The peer reset the stream without a response.

kNotConnected 

Transport disconnected.

Constructor & Destructor Documentation

◆ TrackStatusHandler()

quicr::TrackStatusHandler::TrackStatusHandler ( const FullTrackName &  full_track_name)
explicitprotected

Constructs an unsubmitted request for a track.

Parameters
full_track_nameTrack to query.

Member Function Documentation

◆ Create()

static std::shared_ptr<TrackStatusHandler> quicr::TrackStatusHandler::Create ( const FullTrackName &  full_track_name)
inlinestatic

Creates a track-status request handler.

Parameters
full_track_nameTrack to query.
Returns
Shared ownership of a handler initially in kNotRequested.

◆ Get()

template<typename T >
requires std::is_base_of_v<TrackHandler, T> std::shared_ptr<T> quicr::TrackHandler::Get ( )
inlineinherited

Get the derived type of the track handler.

Template Parameters
TDerived type of the track handler.
Returns
Shared ownership cast to T, or null when the dynamic type is incompatible.
Exceptions
std::bad_weak_ptrif this object is not currently owned by a shared_ptr.

◆ GetBinding()

Binding quicr::TrackHandler::GetBinding ( ) const
inlineinherited

◆ GetConnection()

std::shared_ptr<Connection> quicr::TrackHandler::GetConnection ( ) const
inherited

◆ GetConnectionId()

uint64_t quicr::TrackHandler::GetConnectionId ( ) const
inlinenoexceptinherited

Gets the transport connection identifier assigned by the session.

Returns
Connection ID, or the initial value zero before assignment.

◆ GetError()

std::optional<Error<ErrorCode> > quicr::TrackStatusHandler::GetError ( ) const
Returns
A copy of the rejection, or std::nullopt until/unless status is kError.

◆ GetFullTrackName()

FullTrackName quicr::TrackHandler::GetFullTrackName ( ) const
inlinenoexceptinherited

Get the full track name.

Returns
A copy of the full track name.

◆ GetRequestId()

std::optional<uint64_t> quicr::TrackHandler::GetRequestId ( ) const
inlinenoexceptinherited

Get the request ID.

Returns
Current connection-scoped request ID, or std::nullopt when none is assigned.

◆ GetRequestStreamId()

std::optional<uint64_t> quicr::TrackHandler::GetRequestStreamId ( ) const
inherited

Get the stream ID of the request control stream.

Returns
Request stream's ID, or std::nullopt if no stream is attached.
Note
Thread-safe with request-stream installation/removal.

◆ GetResponse()

std::optional<TrackStatusResponse> quicr::TrackStatusHandler::GetResponse ( ) const
Returns
A copy of the successful response, or std::nullopt until/unless status is kOk.

◆ GetSession()

const std::weak_ptr<Session>& quicr::TrackHandler::GetSession ( ) const
protectednoexceptinherited

Gets the non-owning session handle.

Returns
Borrowed reference to the stored weak pointer, valid for this handler's lifetime. Callers must lock it before use.

◆ GetStatus()

Status quicr::TrackStatusHandler::GetStatus ( ) const
Returns
A thread-safe snapshot of the current request status.

◆ RequestError()

void quicr::TrackStatusHandler::RequestError ( ErrorCode  error_code,
std::string  reason 
)
overrideprotectedvirtual

Records a peer rejection while a response is pending.

Parameters
error_codePeer-provided request error code.
reasonPeer-provided diagnostic text, moved into the stored error.

A late error received after the pending state ended is ignored.

Reimplemented from quicr::TrackHandler.

◆ RequestOkReceived()

void quicr::TrackStatusHandler::RequestOkReceived ( const messages::Parameters &  params)
overrideprotectedvirtual

Rejects an impossible generic REQUEST_OK path.

Parameters
paramsUnused response parameters.
Exceptions
std::logic_errorAlways; TRACK_STATUS responses are decoded directly by the session.

Implements quicr::TrackHandler.

◆ RequestUpdateReceived()

Reply<messages::Parameters, ErrorCode> quicr::TrackStatusHandler::RequestUpdateReceived ( const messages::Parameters &  params)
overrideprotectedvirtual

Rejects REQUEST_UPDATE for a TRACK_STATUS request.

Parameters
paramsUnused update parameters.
Returns
Never returns.
Exceptions
messages::ProtocolViolationExceptionAlways.

Implements quicr::TrackHandler.

◆ SetRequestId()

void quicr::TrackHandler::SetRequestId ( std::optional< uint64_t >  request_id)
inlineinherited

Sets or clears the connection-scoped request ID.

Parameters
request_idRequest ID assigned by the session, or std::nullopt when unbound.
Note
Thread-safe with request-stream installation and removal.

◆ SetTransport()

void quicr::TrackHandler::SetTransport ( std::shared_ptr< Session >  transport)
protectedinherited

Sets the session used for control and data operations.

Parameters
transportSession retained weakly; passing null clears effective access.
Note
The caller must keep the session alive independently.

◆ StatusChanged()

virtual void quicr::TrackStatusHandler::StatusChanged ( Status  status)
virtual

Reports completion with kOk or kError.

Parameters
statusNew terminal status.
Note
The default implementation does nothing. The callback runs outside the handler mutex, so getters may safely be called from an override.

Member Data Documentation

◆ binding_operation_mutex_

std::mutex quicr::TrackHandler::binding_operation_mutex_
protectedinherited

◆ full_track_name_

FullTrackName quicr::TrackHandler::full_track_name_
protectedinherited

Full track identity retained for the handler's lifetime.


The documentation for this class was generated from the following file: