chromium/net/third_party/quiche/src/quiche/quic/core/web_transport_write_blocked_list.h

// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef QUICHE_QUIC_CORE_WEB_TRANSPORT_WRITE_BLOCKED_LIST_H_
#define QUICHE_QUIC_CORE_WEB_TRANSPORT_WRITE_BLOCKED_LIST_H_

#include <cstddef>
#include <limits>
#include <ostream>
#include <string>

#include "absl/container/flat_hash_map.h"
#include "quiche/quic/core/quic_stream_priority.h"
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/core/quic_write_blocked_list.h"
#include "quiche/common/btree_scheduler.h"
#include "quiche/common/platform/api/quiche_export.h"
#include "quiche/web_transport/web_transport.h"

namespace quic {

// Scheduler that is capable of handling both regular HTTP/3 priorities and
// WebTransport priorities for multiple sessions at the same time.
//
// Here is a brief overview of the scheme:
//   - At the top, there are HTTP/3 streams that are ordered by urgency as
//     defined in RFC 9218.
//   - The HTTP/3 connection can be a host to multiple WebTransport sessions.
//     Those are identified by the ID of the HTTP/3 control stream that created
//     the session; they also inherit the priority from that stream.
//   - The sessions consist of send groups that all have equal priority.
//   - The send groups have individual WebTransport data streams; each data
//     stream has a send order, which is a strict priority expressed as int64.
//
// To simplify the implementation of an already excessively complex scheme, this
// class makes a couple of affordances:
//   - Instead of first scheduling an individual session, then scheduling a
//     group within it, it schedules session-group pairs at the top level. This
//     is technically allowed by the spec, but it does mean that sessions with
//     more groups may get more bandwidth.
//   - Incremental priorities are not currently supported.
class QUICHE_EXPORT WebTransportWriteBlockedList
    : public QuicWriteBlockedListInterface {};

}  // namespace quic

#endif  // QUICHE_QUIC_CORE_WEB_TRANSPORT_WRITE_BLOCKED_LIST_H_