1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-07-30 14:43:05 +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

@ -355,7 +355,7 @@ FrameScheduler::scheduleFramesForPacket(
}
return SchedulingResult(
none, std::move(builder).buildPacket(), shortHeaderPadding);
std::nullopt, std::move(builder).buildPacket(), shortHeaderPadding);
}
bool FrameScheduler::hasData() const {
@ -401,7 +401,7 @@ bool StreamFrameScheduler::writeStreamLossBuffers(
bufferLen, // writeBufferLen -- only the len of the single buffer.
bufferLen, // flowControlLen -- not relevant, already flow controlled.
buffer->eof,
none /* skipLenHint */,
std::nullopt /* skipLenHint */,
stream.groupId);
if (res.hasError()) {
throw QuicInternalException(
@ -650,7 +650,7 @@ bool StreamFrameScheduler::writeStreamFrame(
bufferLen,
flowControlLen,
canWriteFin,
none /* skipLenHint */,
std::nullopt /* skipLenHint */,
stream.groupId);
if (res.hasError()) {
throw QuicInternalException(
@ -1085,7 +1085,7 @@ CloningScheduler::scheduleFramesForPacket(
conn_.bufAccessor->trimEnd(conn_.bufAccessor->length() - prevSize);
}
}
return SchedulingResult(none, none, 0);
return SchedulingResult(std::nullopt, std::nullopt, 0);
}
folly::StringPiece CloningScheduler::name() const {