mirror of
https://github.com/facebook/proxygen.git
synced 2026-10-24 01:33:54 +03:00
remove ServerPushLifecycleCallback
Summary: removes `ServerPushLifecycleCallback`, its mock, and `ServerPushLifecycle.h`, continued efforts to remove all things http push related in proxygen/lib Reviewed By: jbeshay, Carl-Elkhoury Differential Revision: D124385264 fbshipit-source-id: f529f4f8a5e16a8b2af6e0adf4725ff1008f4955
This commit is contained in:
committed by
meta-codesync[bot]
parent
7094da18fb
commit
205f1bf7fd
@@ -33,7 +33,6 @@
|
||||
#include <proxygen/lib/http/session/HTTPSessionController.h>
|
||||
#include <proxygen/lib/http/session/HTTPTransaction.h>
|
||||
#include <proxygen/lib/http/session/QuicProtocolInfo.h>
|
||||
#include <proxygen/lib/http/session/ServerPushLifecycle.h>
|
||||
#include <proxygen/lib/http/session/SessionLoopCallback.h>
|
||||
#include <proxygen/lib/http/session/WebTransportFilter.h>
|
||||
#include <proxygen/lib/utils/ConditionalGate.h>
|
||||
@@ -115,10 +114,6 @@ class HQSession
|
||||
return maxAllowedPushId_;
|
||||
}
|
||||
|
||||
void setServerPushLifecycleCallback(ServerPushLifecycleCallback* cb) {
|
||||
serverPushLifecycleCb_ = cb;
|
||||
}
|
||||
|
||||
class ConnectCallback {
|
||||
public:
|
||||
virtual ~ConnectCallback() = default;
|
||||
@@ -753,10 +748,6 @@ class HQSession
|
||||
mutable folly::SocketAddress cachedLocalAddr_;
|
||||
mutable folly::SocketAddress cachedPeerAddr_;
|
||||
|
||||
// Callback pointer used for correctness testing. Not used
|
||||
// for session logic.
|
||||
ServerPushLifecycleCallback* serverPushLifecycleCb_{nullptr};
|
||||
|
||||
// Debug feature to test the impact of request body prioritization.
|
||||
bool enableEgressPrioritization_{true};
|
||||
|
||||
|
||||
@@ -240,16 +240,6 @@ void HQUpstreamSession::HQIngressPushStream::bindTo(quic::StreamId streamId) {
|
||||
|
||||
// Re-enable reads
|
||||
session.resumeReadsForPushStream(streamId);
|
||||
|
||||
// Notify testing callbacks that a full push transaction
|
||||
// has been successfully initialized
|
||||
if (session.serverPushLifecycleCb_) {
|
||||
session.serverPushLifecycleCb_->onPushedTxn(&txn_,
|
||||
streamId,
|
||||
getPushId(),
|
||||
txn_.getAssocTxnId().value(),
|
||||
false /* eof */);
|
||||
}
|
||||
}
|
||||
|
||||
// This can only be unbound in that it has not received a stream ID yet
|
||||
|
||||
@@ -141,16 +141,9 @@ class HQUpstreamSession : public HQSession {
|
||||
// Ingress push streams are not initialized
|
||||
// until after the nascent push stream
|
||||
// has been received
|
||||
// notify the testing callbacks that a half-opened push transaction
|
||||
// has been created
|
||||
|
||||
// NOTE: change the API to avoid accepting parent txn ids
|
||||
// as optional
|
||||
CHECK(parentTxnId.has_value());
|
||||
auto cb = ((HQUpstreamSession&)session_).serverPushLifecycleCb_;
|
||||
if (cb) {
|
||||
cb->onHalfOpenPushedTxn(&txn_, pushId, *parentTxnId, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Bind this stream to a transport stream
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <folly/Optional.h>
|
||||
#include <proxygen/lib/http/codec/HQFramer.h>
|
||||
#include <proxygen/lib/http/codec/HTTPCodec.h>
|
||||
|
||||
namespace proxygen {
|
||||
|
||||
class HTTPMessage;
|
||||
class HTTPTransaction;
|
||||
|
||||
// A callback class for observing pushed transactions.
|
||||
// It is built for HTTP3 state transitions, but is backward
|
||||
// compatible with HTTP2
|
||||
//
|
||||
// The state transition diagram (states unique to HTTP3
|
||||
// are marked with "h3")
|
||||
//
|
||||
// The sole purpose of this callback is tesing the correct
|
||||
// behavior of the server push.
|
||||
//
|
||||
//
|
||||
// .-----------------.
|
||||
// ( Start )
|
||||
// `-----------------'
|
||||
// |
|
||||
// +---------------+--------------+
|
||||
// v v
|
||||
// +---------------------+ +---------------------h3
|
||||
// +---| onPushPromiseBegin | | onNascentBegin |---+
|
||||
// | +---------------------+ +----------------------+ |
|
||||
// | | | |
|
||||
// | v v |
|
||||
// | +---------------------+ +------------------h3 |
|
||||
// | | onPushPromise |-------+ | onNascentStream |----+
|
||||
// | +---------------------+ | +-------------------+ |
|
||||
// | | | | |
|
||||
// | +---+ | | |
|
||||
// | v | | |
|
||||
// | +------------------------h3 | | |
|
||||
// +--+--| onHalfPushedTransaction | | +---+ |
|
||||
// | | +-------------------------+ | | |
|
||||
// | | | | | |
|
||||
// | | +--------------+ | |
|
||||
// | | v | |
|
||||
// | +----------+ +-------------------------+ | |
|
||||
// | +------| onFullPushedTransaction |<-+ |
|
||||
// | v +-------------------------+ |
|
||||
// | .----------------h3 | |
|
||||
// | (onPushedTxnTimeout ) | .-----------------h3 |
|
||||
// | `-----------------' | ( onOrphanedNascent )<--+
|
||||
// | +--+ `------------------' |
|
||||
// | .-----------------h3 | .------------h3 |
|
||||
// +->( onOrphanedHfOpnTxn ) | ( onNascentEof )<-+
|
||||
// `------------------' | `-------------'
|
||||
// v
|
||||
// .-----------.
|
||||
// ( onTxnEof )
|
||||
// `-----------'
|
||||
//
|
||||
//
|
||||
class ServerPushLifecycleCallback {
|
||||
public:
|
||||
virtual ~ServerPushLifecycleCallback() = default;
|
||||
|
||||
/**
|
||||
* A push promise has arrived, but has not been fully parsed yet
|
||||
*/
|
||||
virtual void onPushPromiseBegin(HTTPCodec::StreamID /* parent streamID */,
|
||||
hq::PushId /* pushID */) = 0;
|
||||
|
||||
/**
|
||||
* A push promise has arrived. Headers have been parsed.
|
||||
*/
|
||||
virtual void onPushPromise(HTTPCodec::StreamID /* parent streamID */,
|
||||
hq::PushId /* pushID */,
|
||||
HTTPMessage* /* msg */) = 0;
|
||||
|
||||
/**
|
||||
* A push stream has arrived, but the pushId has not been received yet
|
||||
*/
|
||||
virtual void onNascentPushStreamBegin(
|
||||
HTTPCodec::StreamID /* push stream ID */, bool /* eom */) = 0;
|
||||
|
||||
/**
|
||||
* A push stream has arrived, and the pushId has been received.
|
||||
*/
|
||||
virtual void onNascentPushStream(HTTPCodec::StreamID /* push stream ID */,
|
||||
hq::PushId /* pushId */,
|
||||
bool /* eom */) = 0;
|
||||
|
||||
/**
|
||||
* A push stream has ended before being converted to to full
|
||||
* ingress stream
|
||||
*/
|
||||
virtual void onNascentEof(HTTPCodec::StreamID /* push stream ID */,
|
||||
folly::Optional<hq::PushId> /* pushId */) = 0;
|
||||
|
||||
/**
|
||||
* A nascent push stream has timed out. For more details, see
|
||||
* "The Personal History, Adventures, Experience and Observation
|
||||
* of David Copperfield the Younger of Blunderstone Rookery
|
||||
* (Which He Never Meant to Publish on Any Account).", Dickens C.
|
||||
*/
|
||||
virtual void onOrphanedNascentStream(
|
||||
HTTPCodec::StreamID /* push stream ID */,
|
||||
folly::Optional<hq::PushId> /* pushId */) = 0;
|
||||
|
||||
/**
|
||||
* A push promise has arrived, the push id and the assoc (parent) id
|
||||
* are known.
|
||||
*/
|
||||
virtual void onHalfOpenPushedTxn(const HTTPTransaction* /* txn */,
|
||||
hq::PushId /* server push id */,
|
||||
HTTPCodec::StreamID /* assoc stream id */,
|
||||
bool /* eom */) = 0;
|
||||
|
||||
/**
|
||||
* Both the promise and the stream have arrived. The newly created transport
|
||||
* can be created
|
||||
*/
|
||||
virtual void onPushedTxn(const HTTPTransaction* /* txn */,
|
||||
HTTPCodec::StreamID /* push ingress stream */,
|
||||
hq::PushId /* server push id */,
|
||||
HTTPCodec::StreamID /* assoc stream id */,
|
||||
bool /* eom */) = 0;
|
||||
|
||||
/**
|
||||
* A fully opened pushed transaction has timed out
|
||||
*/
|
||||
virtual void onPushedTxnTimeout(const HTTPTransaction* /* txn */) = 0;
|
||||
|
||||
/**
|
||||
* A half-opened push transaction has timed out
|
||||
*/
|
||||
virtual void onOrphanedHalfOpenPushedTxn(
|
||||
const HTTPTransaction* /* txn */) = 0;
|
||||
|
||||
/**
|
||||
* Push ID limit exceeded, possibly closing the stream
|
||||
*/
|
||||
virtual void onPushIdLimitExceeded(
|
||||
hq::PushId /* incoming push id */,
|
||||
folly::Optional<hq::PushId> /* maximal allowed push id */,
|
||||
folly::Optional<HTTPCodec::StreamID> /* possible push stream */) = 0;
|
||||
|
||||
}; // ServerPushLifecycleCallback
|
||||
|
||||
} // namespace proxygen
|
||||
@@ -17,185 +17,6 @@
|
||||
|
||||
namespace proxygen {
|
||||
|
||||
class MockServerPushLifecycleCallback : public ServerPushLifecycleCallback {
|
||||
public:
|
||||
~MockServerPushLifecycleCallback() override = default;
|
||||
|
||||
MOCK_METHOD(void,
|
||||
onPushPromiseBegin,
|
||||
(HTTPCodec::StreamID /* parent streamID */,
|
||||
hq::PushId /* pushID */));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
onPushPromise,
|
||||
(HTTPCodec::StreamID /* parent streamID */,
|
||||
hq::PushId /* pushID */,
|
||||
HTTPMessage* /* msg */));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
onNascentPushStreamBegin,
|
||||
(HTTPCodec::StreamID /* push stream ID */, bool /* eom */));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
onNascentPushStream,
|
||||
(HTTPCodec::StreamID /* push stream ID */,
|
||||
hq::PushId /* server push id */,
|
||||
bool /* eom */));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
onNascentEof,
|
||||
(HTTPCodec::StreamID /* push stream ID */,
|
||||
folly::Optional<hq::PushId> /* push id */));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
onOrphanedNascentStream,
|
||||
(HTTPCodec::StreamID /* push stream ID */,
|
||||
folly::Optional<hq::PushId> /* push id */));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
onHalfOpenPushedTxn,
|
||||
(const HTTPTransaction* /* txn */,
|
||||
hq::PushId /* push id */,
|
||||
HTTPCodec::StreamID /* assoc stream id */,
|
||||
bool /* eom */));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
onPushedTxn,
|
||||
(const HTTPTransaction* /* txn */,
|
||||
HTTPCodec::StreamID /* push stream id */,
|
||||
hq::PushId /* push id */,
|
||||
HTTPCodec::StreamID /* assoc stream id */,
|
||||
bool /* eom */));
|
||||
|
||||
MOCK_METHOD(void, onPushedTxnTimeout, (const HTTPTransaction* /* txn */));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
onOrphanedHalfOpenPushedTxn,
|
||||
(const HTTPTransaction* /* txn */));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
onPushIdLimitExceeded,
|
||||
(hq::PushId /* incoming push id */,
|
||||
folly::Optional<hq::PushId> /* max allowed push id */,
|
||||
folly::Optional<HTTPCodec::StreamID> /* stream */));
|
||||
|
||||
using PushPromiseBeginF =
|
||||
std::function<void(HTTPCodec::StreamID, hq::PushId)>;
|
||||
using PushPromiseF =
|
||||
std::function<void(HTTPCodec::StreamID, hq::PushId, HTTPMessage*)>;
|
||||
using NascentPushStreamBeginF =
|
||||
std::function<void(HTTPCodec::StreamID, bool)>;
|
||||
using NascentPushStreamF =
|
||||
std::function<void(HTTPCodec::StreamID, hq::PushId, bool)>;
|
||||
using NascentEofF =
|
||||
std::function<void(HTTPCodec::StreamID, folly::Optional<hq::PushId>)>;
|
||||
using OrphanedNascentStreamF =
|
||||
std::function<void(HTTPCodec::StreamID, folly::Optional<hq::PushId>)>;
|
||||
using HalfOpenPushedTxnF = std::function<void(
|
||||
const HTTPTransaction*, hq::PushId, HTTPCodec::StreamID, bool)>;
|
||||
using PushedTxnF = std::function<void(const HTTPTransaction*,
|
||||
HTTPCodec::StreamID,
|
||||
hq::PushId,
|
||||
HTTPCodec::StreamID,
|
||||
bool)>;
|
||||
using PushedTxnTimeoutF = std::function<void(const HTTPTransaction*)>;
|
||||
using OrphanedHalfOpenPushedTxnF =
|
||||
std::function<void(const HTTPTransaction*)>;
|
||||
|
||||
using PushIdLimitExceededF =
|
||||
std::function<void(hq::PushId,
|
||||
folly::Optional<hq::PushId>,
|
||||
folly::Optional<HTTPCodec::StreamID>)>;
|
||||
|
||||
void expectPushPromiseBegin(PushPromiseBeginF impl = nullptr) {
|
||||
auto& exp = EXPECT_CALL(*this, onPushPromiseBegin(testing::_, testing::_));
|
||||
if (impl) {
|
||||
exp.WillOnce(testing::Invoke(impl));
|
||||
}
|
||||
}
|
||||
|
||||
void expectPushPromise(PushPromiseF impl = nullptr) {
|
||||
auto& exp =
|
||||
EXPECT_CALL(*this, onPushPromise(testing::_, testing::_, testing::_));
|
||||
if (impl) {
|
||||
exp.WillOnce(testing::Invoke(impl));
|
||||
}
|
||||
}
|
||||
|
||||
void expectNascentPushStreamBegin(NascentPushStreamBeginF impl = nullptr) {
|
||||
auto& exp =
|
||||
EXPECT_CALL(*this, onNascentPushStreamBegin(testing::_, testing::_));
|
||||
if (impl) {
|
||||
exp.WillOnce(testing::Invoke(impl));
|
||||
}
|
||||
}
|
||||
|
||||
void expectNascentPushStream(NascentPushStreamF impl = nullptr) {
|
||||
auto& exp = EXPECT_CALL(
|
||||
*this, onNascentPushStream(testing::_, testing::_, testing::_));
|
||||
if (impl) {
|
||||
exp.WillOnce(testing::Invoke(impl));
|
||||
}
|
||||
}
|
||||
|
||||
void expectNascentEof(NascentEofF impl = nullptr) {
|
||||
auto& exp = EXPECT_CALL(*this, onNascentEof(testing::_, testing::_));
|
||||
if (impl) {
|
||||
exp.WillOnce(testing::Invoke(impl));
|
||||
}
|
||||
}
|
||||
|
||||
void expectOrphanedNascentStream(OrphanedNascentStreamF impl = nullptr) {
|
||||
auto& exp =
|
||||
EXPECT_CALL(*this, onOrphanedNascentStream(testing::_, testing::_));
|
||||
if (impl) {
|
||||
exp.WillOnce(testing::Invoke(impl));
|
||||
}
|
||||
}
|
||||
|
||||
void expectHalfOpenPushedTxn(HalfOpenPushedTxnF impl = nullptr) {
|
||||
auto& exp = EXPECT_CALL(
|
||||
*this,
|
||||
onHalfOpenPushedTxn(testing::_, testing::_, testing::_, testing::_));
|
||||
if (impl) {
|
||||
exp.WillOnce(testing::Invoke(impl));
|
||||
}
|
||||
}
|
||||
|
||||
void expectPushedTxn(PushedTxnF impl = nullptr) {
|
||||
auto& exp = EXPECT_CALL(
|
||||
*this,
|
||||
onPushedTxn(
|
||||
testing::_, testing::_, testing::_, testing::_, testing::_));
|
||||
if (impl) {
|
||||
exp.WillOnce(testing::Invoke(impl));
|
||||
}
|
||||
}
|
||||
|
||||
void expectPushedTxnTimeout(PushedTxnTimeoutF impl = nullptr) {
|
||||
auto& exp = EXPECT_CALL(*this, onPushedTxnTimeout(testing::_));
|
||||
if (impl) {
|
||||
exp.WillOnce(testing::Invoke(impl));
|
||||
}
|
||||
}
|
||||
|
||||
void expectOrphanedHalfOpenPushedTxn(
|
||||
OrphanedHalfOpenPushedTxnF impl = nullptr) {
|
||||
auto& exp = EXPECT_CALL(*this, onOrphanedHalfOpenPushedTxn(testing::_));
|
||||
if (impl) {
|
||||
exp.WillOnce(testing::Invoke(impl));
|
||||
}
|
||||
}
|
||||
|
||||
void expectPushIdLimitExceeded(PushIdLimitExceededF impl = nullptr) {
|
||||
auto& exp = EXPECT_CALL(
|
||||
*this, onPushIdLimitExceeded(testing::_, testing::_, testing::_));
|
||||
if (impl) {
|
||||
exp.WillOnce(testing::Invoke(impl));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class MockConnectCallback : public HQSession::ConnectCallback {
|
||||
public:
|
||||
MOCK_METHOD(void, connectSuccess, ());
|
||||
|
||||
Reference in New Issue
Block a user