LibQuicR
|
MOQ track handler for published track. More...
#include <publish_track_handler.h>
Public Types | |
enum class | PublishObjectStatus : uint8_t { kOk = 0 , kInternalError , kNotAuthorized , kNotAnnounced , kNoSubscribers , kObjectPayloadLengthExceeded , kPreviousObjectTruncated , kNoPreviousObject , kObjectDataComplete , kObjectContinuationDataNeeded , kObjectDataIncomplete , kObjectDataTooLarge , kPreviousObjectNotCompleteMustStartNewGroup , kPreviousObjectNotCompleteMustStartNewTrack } |
Publish status codes. More... | |
enum class | Status : uint8_t { kOk = 0 , kNotConnected , kNotAnnounced , kPendingAnnounceResponse , kAnnounceNotAuthorized , kNoSubscribers , kSendingUnannounce , kSubscriptionUpdated , kNewGroupRequested } |
Status codes for the publish track. More... | |
Public Member Functions | |
void | SetDefaultPriority (const uint8_t priority) noexcept |
set/update the default priority for published objects | |
void | SetDefaultTTL (const uint32_t ttl) noexcept |
set/update the default TTL expiry for published objects | |
void | SetDefaultTrackMode (const TrackMode track_mode) noexcept |
set/update the default track mode for objects | |
constexpr Status | GetStatus () const noexcept |
Get the publish status. | |
PublishObjectStatus | PublishObject (const ObjectHeaders &object_headers, BytesSpan data) |
Publish [full] object. | |
PublishObjectStatus | ForwardPublishedData (bool is_new_stream, std::shared_ptr< const std::vector< uint8_t > > data) |
Forward received object data to subscriber/relay/remote client. | |
PublishObjectStatus | PublishPartialObject (const ObjectHeaders &object_headers, BytesSpan data) |
Publish object to the announced track. | |
Callbacks | |
virtual void | StatusChanged (Status status) |
Notification of publish track status change. | |
virtual void | MetricsSampled (const PublishTrackMetrics &metrics) |
Notification callback to provide sampled metrics. | |
Static Public Member Functions | |
static std::shared_ptr< PublishTrackHandler > | Create (const FullTrackName &full_track_name, TrackMode track_mode, uint8_t default_priority, uint32_t default_ttl) |
Create a shared Publish track handler. | |
Public Attributes | |
PublishTrackMetrics | publish_track_metrics_ |
Publish metrics for the track. | |
Protected Member Functions | |
PublishTrackHandler (const FullTrackName &full_track_name, TrackMode track_mode, uint8_t default_priority, uint32_t default_ttl) | |
Publish track handler constructor. | |
MOQ track handler for published track.
MOQ publish track handler defines all track related callbacks and functions for publish. Track handler operates on a single track (namespace + name).
This extends the base track handler to add publish (aka send) handling
|
strong |
Publish status codes.
Enumerator | |
---|---|
kOk | |
kInternalError | |
kNotAuthorized | |
kNotAnnounced | |
kNoSubscribers | |
kObjectPayloadLengthExceeded | |
kPreviousObjectTruncated | |
kNoPreviousObject | |
kObjectDataComplete | |
kObjectContinuationDataNeeded | |
kObjectDataIncomplete | PublishObject() was called when continuation data remains. |
kObjectDataTooLarge | Indicates that the published object data is too large based on the object header payload size plus any/all data that was sent already. |
kPreviousObjectNotCompleteMustStartNewGroup | Previous object payload has not been completed and new object cannot start in per-group track mode unless new group is used. |
kPreviousObjectNotCompleteMustStartNewTrack | Previous object payload has not been completed and new object cannot start in per-track track mode without creating a new track. This requires to unpublish and to publish track again. |
|
strong |
|
inlineprotected |
Publish track handler constructor.
full_track_name | Full track name |
track_mode | The track mode to operate using |
default_priority | Default priority for objects if not specified in ObjectHeaderss |
default_ttl | Default TTL for objects if not specified in ObjectHeaderss |
|
inlinestatic |
Create a shared Publish track handler.
full_track_name | Full track name |
track_mode | The track mode to operate using |
default_priority | Default priority for objects if not specified in ObjectHeaderss |
default_ttl | Default TTL for objects if not specified in ObjectHeaderss |
PublishObjectStatus quicr::PublishTrackHandler::ForwardPublishedData | ( | bool | is_new_stream, |
std::shared_ptr< const std::vector< uint8_t > > | data ) |
Forward received object data to subscriber/relay/remote client.
This method is similar to PublishObject except that the data forwarded is byte array level data, which should have already been encoded upon receive from the origin publisher. Relays implement this method to forward bytes received to subscriber connection.
is_new_stream | Indicates if this data starts a new stream |
data | MoQ data to send |
|
inlineconstexprnoexcept |
Get the publish status.
|
virtual |
Notification callback to provide sampled metrics.
Callback will be triggered on Config::metrics_sample_ms to provide the sampled data based on the sample period. After this callback, the period/sample based metrics will reset and start over for the new period.
metrics | Copy of the published metrics for the sample period |
PublishObjectStatus quicr::PublishTrackHandler::PublishObject | ( | const ObjectHeaders & | object_headers, |
BytesSpan | data ) |
Publish [full] object.
Publish a full object. If not announced, it will be announced. Status will indicate if there are no subscribers. In this case, the object will not be sent.
Restrictions:
object_headers | Object headers, must include group and object Ids |
data | Full complete payload data for the object |
PublishObjectStatus quicr::PublishTrackHandler::PublishPartialObject | ( | const ObjectHeaders & | object_headers, |
BytesSpan | data ) |
Publish object to the announced track.
Publish a partial object. If not announced, it will be announced. Status will indicate if there are no subscribers. In this case, the object will not be sent.
Restrictions:
object_headers | Object headers, must include group and object Ids |
data | Payload data for the object, must be <= object_headers.payload_length |
|
inlinenoexcept |
set/update the default priority for published objects
|
inlinenoexcept |
set/update the default track mode for objects
|
inlinenoexcept |
set/update the default TTL expiry for published objects
|
virtual |
Notification of publish track status change.
Notification of a change to publish track status, such as when it's ready to publish or not ready to publish
status | Indicates the status of being able to publish |
PublishTrackMetrics quicr::PublishTrackHandler::publish_track_metrics_ |
Publish metrics for the track.
Publish metrics are updated real-time and transport quic metrics on metrics_sample_ms period.