1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-24 04:01:07 +03:00

Mostly remove folly::Optional

Summary:
This is an API break, but it should mostly be a manageable one. We want to be able to compile mvfst internally without exceptions, and folly::Optional is one dependency that makes this challenging. Additionally, we already have an imported secondary optional type for performance/struct size reasons, tiny-optional.

This second optional interface is mostly compatible in an API sense (including the use of std::nullopt) with std::optional. Thus our approach is to remove the dependency on folly::Optional, and offer a quic::Optional instead.

The next diff will properly vendor tiny-optional so that quic::Optional is an independent version of it.

Reviewed By: sharmafb, kvtsoy

Differential Revision: D74133131

fbshipit-source-id: 715f8bb5043ba3bb876cacfe54236887e0686b30
This commit is contained in:
Matt Joras
2025-05-07 23:01:49 -07:00
committed by Facebook GitHub Bot
parent d306793640
commit 9a9dcca57c
159 changed files with 1502 additions and 1209 deletions

View File

@@ -101,7 +101,7 @@ TEST_F(QuicOpenStateTest, InvalidEvent) {
StreamId id = 5;
QuicStreamState stream(id, *conn);
RstStreamFrame frame(1, GenericApplicationErrorCode::UNKNOWN, 0);
auto result = sendRstAckSMHandler(stream, folly::none);
auto result = sendRstAckSMHandler(stream, std::nullopt);
ASSERT_TRUE(result.hasError());
EXPECT_NE(result.error().code.asTransportErrorCode(), nullptr);
}
@@ -321,7 +321,7 @@ TEST_F(QuicResetSentStateTest, RstAck) {
stream.readBuffer.emplace_back(
folly::IOBuf::copyBuffer("One more thing"), 0xABCD, false);
RstStreamFrame frame(id, GenericApplicationErrorCode::UNKNOWN, 0);
auto result = sendRstAckSMHandler(stream, folly::none);
auto result = sendRstAckSMHandler(stream, std::nullopt);
ASSERT_FALSE(result.hasError());
EXPECT_EQ(stream.sendState, StreamSendState::Closed);
@@ -418,7 +418,7 @@ TEST_F(QuicResetSentStateTest, RstAfterReliableRst) {
stream.readBuffer.emplace_back(
folly::IOBuf::copyBuffer("One more thing"), 0xABCD, false);
RstStreamFrame frame(id, GenericApplicationErrorCode::UNKNOWN, 0);
auto result = sendRstAckSMHandler(stream, folly::none);
auto result = sendRstAckSMHandler(stream, std::nullopt);
ASSERT_FALSE(result.hasError());
EXPECT_EQ(stream.sendState, StreamSendState::Closed);
@@ -504,7 +504,7 @@ TEST_F(QuicClosedStateTest, RstAck) {
QuicStreamState stream(id, *conn);
stream.sendState = StreamSendState::Closed;
RstStreamFrame frame(id, GenericApplicationErrorCode::UNKNOWN, 0);
auto result = sendRstAckSMHandler(stream, folly::none);
auto result = sendRstAckSMHandler(stream, std::nullopt);
ASSERT_FALSE(result.hasError());
EXPECT_EQ(stream.sendState, StreamSendState::Closed);
}