mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-08 09:42:06 +03:00
Introduce OptionalIntegral and OptionalMicros
Summary: We have a lot of optionals that are either integral values or std::chrono::microseconds. These end up wasting memory, where we can instead store sentinel values to encode whether the value is there or not. This reduces the effective range of the type by one value, but that is an acceptable tradeoff. Reviewed By: kvtsoy Differential Revision: D57684368 fbshipit-source-id: b406b86011f9b8169b6e5e925265f4829928cc63
This commit is contained in:
committed by
Facebook GitHub Bot
parent
466a0649a1
commit
e903f277da
@@ -52,7 +52,7 @@ enum class TestFrameType : uint8_t {
|
||||
Buf encodeStreamBuffer(
|
||||
StreamId id,
|
||||
StreamBuffer data,
|
||||
Optional<StreamGroupId> groupId = none) {
|
||||
OptionalIntegral<StreamGroupId> groupId = std::nullopt) {
|
||||
auto buf = IOBuf::create(10);
|
||||
folly::io::Appender appender(buf.get(), 10);
|
||||
if (!groupId) {
|
||||
@@ -406,7 +406,7 @@ class TestQuicTransport
|
||||
void addDataToStream(
|
||||
StreamId id,
|
||||
StreamBuffer data,
|
||||
Optional<StreamGroupId> groupId = none) {
|
||||
OptionalIntegral<StreamGroupId> groupId = std::nullopt) {
|
||||
auto buf = encodeStreamBuffer(id, std::move(data), std::move(groupId));
|
||||
SocketAddress addr("127.0.0.1", 1000);
|
||||
onNetworkData(addr, NetworkData(std::move(buf), Clock::now(), 0));
|
||||
|
Reference in New Issue
Block a user