-
Notifications
You must be signed in to change notification settings - Fork 11
Joining fetch #521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Joining fetch #521
Changes from 11 commits
f9d0797
ea45743
df49828
d25baf8
b018d41
8e08db2
61126a4
2ad89e9
b65da50
42ae5a3
9b6446f
18ad52b
61f3972
c2aa367
c589b3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2025 Cisco Systems | ||
| // SPDX-License-Identifier: BSD-2-Clause | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <quicr/detail/messages.h> | ||
| #include <quicr/subscribe_track_handler.h> | ||
|
|
||
| namespace quicr { | ||
| /** | ||
| * JoiningFetchHandler is used internally in order to forward JOINING FETCH | ||
| * streams to their corresponding SUBSCRIBE track handler, for convenience. | ||
| */ | ||
| class JoiningFetchHandler : public SubscribeTrackHandler | ||
| { | ||
| public: | ||
| explicit JoiningFetchHandler(std::shared_ptr<SubscribeTrackHandler> joining_subscribe) | ||
| : SubscribeTrackHandler(joining_subscribe->GetFullTrackName(), | ||
| joining_subscribe->GetPriority(), | ||
| joining_subscribe->GetGroupOrder(), | ||
| joining_subscribe->GetFilterType()) | ||
| , joining_subscribe_(std::move(joining_subscribe)) | ||
| { | ||
| } | ||
| void StreamDataRecv(bool is_start, | ||
| uint64_t stream_id, | ||
| std::shared_ptr<const std::vector<uint8_t>> data) override; | ||
|
|
||
| private: | ||
| std::shared_ptr<SubscribeTrackHandler> joining_subscribe_; | ||
| }; | ||
|
|
||
| } // namespace moq |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -107,8 +107,18 @@ namespace quicr { | |||||
| void UnbindPublisherTrack(ConnectionHandle connection_handle, | ||||||
| const std::shared_ptr<PublishTrackHandler>& track_handler); | ||||||
|
|
||||||
| /** | ||||||
| * @brief Bind a server fetch publisher track handler. | ||||||
| * @param conn_id Connection Id of the client/fetcher. | ||||||
| * @param track_handler The fetch publisher. | ||||||
| */ | ||||||
| void BindFetchTrack(TransportConnId conn_id, std::shared_ptr<PublishFetchHandler> track_handler); | ||||||
|
|
||||||
| /** | ||||||
| * @brief Unbind a server fetch publisher track handler. | ||||||
| * @param conn_id Connection ID of the client/fetcher. | ||||||
| * @param track_handler The fetch publisher. | ||||||
| */ | ||||||
| void UnbindFetchTrack(ConnectionHandle conn_id, const std::shared_ptr<PublishFetchHandler>& track_handler); | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -279,20 +289,14 @@ namespace quicr { | |||||
| */ | ||||||
| virtual void UnsubscribeReceived(ConnectionHandle connection_handle, uint64_t subscribe_id) = 0; | ||||||
|
|
||||||
| // TODO: Their is probably a distinction between track not found, and no objects. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| typedef std::optional<std::pair<messages::GroupId, messages::ObjectId>> LargestAvailable; | ||||||
TimEvens marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| /** | ||||||
| * @brief Callback notification on Fetch message received. | ||||||
| * | ||||||
| * @param connection_handle Source connection ID. | ||||||
| * @param subscribe_id Subscribe ID received. | ||||||
| * @param track_full_name Track full name | ||||||
| * @param attributes Fetch attributes received. | ||||||
| * | ||||||
| * @returns true if user defined conditions of Fetch are satisfied, false otherwise. | ||||||
| * @brief Get the largest available object for the given track, if any. | ||||||
| * @param track_name The track to lookup on. | ||||||
| * @return The largest available object, if any. | ||||||
| */ | ||||||
| virtual bool FetchReceived(ConnectionHandle connection_handle, | ||||||
| uint64_t subscribe_id, | ||||||
| const FullTrackName& track_full_name, | ||||||
| const FetchAttributes& attributes); | ||||||
| virtual LargestAvailable GetLargestAvailable(const FullTrackName& track_name); | ||||||
|
|
||||||
| /** | ||||||
| * @brief Event to run on sending FetchOk. | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,7 +86,7 @@ namespace quicr { | |
| conn_ctx.current_subscribe_id = msg.subscribe_id + 1; | ||
| } | ||
|
|
||
| conn_ctx.recv_sub_id[msg.subscribe_id] = { th.track_namespace_hash, th.track_name_hash }; | ||
| conn_ctx.recv_sub_id[msg.subscribe_id] = { .track_full_name = tfn }; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Supported >= c++20 |
||
|
|
||
| // For client/publisher, notify track that there is a subscriber | ||
| auto ptd = GetPubTrackHandler(conn_ctx, th); | ||
|
|
@@ -120,7 +120,7 @@ namespace quicr { | |
| ptd->SetTrackAlias(msg.track_alias); | ||
| ptd->SetStatus(PublishTrackHandler::Status::kOk); | ||
|
|
||
| conn_ctx.recv_sub_id[msg.subscribe_id] = { th.track_namespace_hash, th.track_name_hash }; | ||
| conn_ctx.recv_sub_id[msg.subscribe_id] = { .track_full_name = tfn }; | ||
|
||
| return true; | ||
| } | ||
| case messages::ControlMessageType::kSubscribeUpdate: { | ||
|
|
@@ -142,8 +142,8 @@ namespace quicr { | |
| return true; | ||
| } | ||
|
|
||
| auto [ns_hash, n_hash] = conn_ctx.recv_sub_id[msg.subscribe_id]; | ||
| auto th = TrackHash(ns_hash, n_hash); | ||
| auto tfn = conn_ctx.recv_sub_id[msg.subscribe_id].track_full_name; | ||
| auto th = TrackHash(tfn); | ||
|
|
||
| // For client/publisher, notify track that there is a subscriber | ||
| auto ptd = GetPubTrackHandler(conn_ctx, th); | ||
|
|
@@ -333,7 +333,9 @@ namespace quicr { | |
| return true; | ||
| } | ||
|
|
||
| const auto& [ns_hash, name_hash] = th_it->second; | ||
| const auto& th = TrackHash(th_it->second.track_full_name); | ||
| const auto& ns_hash = th.track_namespace_hash; | ||
| const auto& name_hash = th.track_name_hash; | ||
| SPDLOG_LOGGER_DEBUG(logger_, | ||
| "Received unsubscribe conn_id: {0} subscribe_id: {1}", | ||
| conn_ctx.connection_handle, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thought here is that a fetch could be denied. We still need that for the future, but I suppose we can add it back then.