Summary:
This commit converts IntervalSet to use CHECKs instead of throwing exceptions and provides safe tryInsert methods that return quic::Expected for error handling.
**Core Problem Solved:**
IntervalSet was throwing `std::invalid_argument` exceptions in two scenarios:
1. When constructing an Interval with `start > end`
2. When interval bounds exceed the maximum allowed value
This change eliminates exceptions in favor of CHECKs (for internal validation) and Expected-based error handling (for caller validation).
**Implementation Details:**
**1. IntervalSet Core Changes:**
- Replaced `throw std::invalid_argument` with `CHECK_LE` in Interval constructor
- Replaced `throw std::invalid_argument` with `CHECK_LE` in `insert(start, end)`
- Added `IntervalSetError` enum for error classification
- Added `folly::Expected` include
**2. Safe API Layer:**
- Added `tryInsert(interval)` method returning `Expected<Unit, IntervalSetError>`
- Added `tryInsert(start, end)` method with pre-validation
- Added `tryInsert(point)` method
- Added static `Interval::tryCreate()` method for safe interval construction
**3. Updated Code:**
- **QuicWriteCodec.cpp**: Updated `fillFrameWithPacketReceiveTimestamps` to use `tryInsert`
- Returns `QuicError` if interval validation fails
- Maintains existing error handling patterns
- **QuicTransportFunctions.cpp**: Updated `implicitAckCryptoStream` to use `tryInsert`
- Logs errors and continues processing other packets
- Robust error handling for crypto stream implicit acks
Reviewed By: kvtsoy
Differential Revision: D76792362
fbshipit-source-id: 5bd7c22e69a91d60cc41c603a1f2380893f4c8a0
Summary:
Previously,
* `RawBuf` was a typealias for `std::unique_ptr<folly::IOBuf>`
* `Buf` was a typealias for `folly::IOBuf`
In this diff,
* `Buf` is a typealias for `folly::IOBuf`
* `BufPtr` is a typealias for `std::unique_ptr<folly::IOBuf>`
Reviewed By: hanidamlaj
Differential Revision: D73206576
fbshipit-source-id: 454bf6ccfce3d6571e5e931889263ed98cc24af3
Summary: With reliable resets, we don't want to drop the entire `readBuffer`. Rather, we want to discard data that doesn't have to be reliably delivered.
Reviewed By: jbeshay
Differential Revision: D67766227
fbshipit-source-id: f8b0d1a51db3b84ad549c09021a0c1490f2b1c23
Summary: With reliable resets, we can only safely close a stream once all bytes until the reliable size have been ACKed by the peer. We're going to use this helper function to aid us in that.
Reviewed By: mjoras
Differential Revision: D66781309
fbshipit-source-id: 66094929b53c9eab3185e05b8a033b112577b60b
Summary: Some of the logic in subsequent diffs becomes a little easier if we change the "remove after" to "remove starting at", because we don't have to subtract 1 off of the reliable reset offset before passing it into these functions.
Reviewed By: jbeshay
Differential Revision: D66275065
fbshipit-source-id: 54a92dde7b23d09a1f8f59bfeabbec4fb149518a
Summary: When we send a reliable reset, we don't want to reset the entire `writeBufMeta`, `retransmissionBufMetas`, and `lossBufMetas`. We only want to reset them up to the `reliableSize`. I'm making helper functions to do this.
Reviewed By: jbeshay
Differential Revision: D66120070
fbshipit-source-id: 588db71b846247a9a2316f46ca6c6caef9246ba9
Summary: When we send a reliable reset, we don't want to reset the entire `writeBuffer`, `retransmissionBuffer`, `lossBuffer`, and `pendingWrites`. We only want to reset them up to the `reliableSize`. I'm making helper functions to do this.
Reviewed By: jbeshay
Differential Revision: D64907982
fbshipit-source-id: ad9256638f5e0cb5f7c038e2c9d12253a7776b2d