Summary:
- trimAtMost() can be implemented via splitAtMost()
- trimAtMost() now releases owned IOBuf if the entire chain is consumed
Reviewed By: mjoras
Differential Revision: D46776767
fbshipit-source-id: 0ace20d07d8b9adc1a5171e39732b8278776c332
Summary:
Getting an `std::string` out of the data in a `IOBuf` chain is a common operation in tests, logging, and at interface boundaries. Currently there isn't an easy way to do it, so either the same boilerplate is replicated everywhere, or people resort to `coalesce().str()`, which is inefficient (it can end up copying the data twice) and non-`const`.
Add methods to append and convert to any char container, like `string`, `fbstring`, `vector<char>`, ...
Reviewed By: philippv
Differential Revision: D31385345
fbshipit-source-id: 8a331771786f7bf1043b59d5c36ac4051e442531
Summary: as title. Also move PushLimit to this section as well
Reviewed By: avasylev
Differential Revision: D22069760
fbshipit-source-id: 7d87e4fa142f0713c1b4a9c33b2f947fe8c740b5
Summary:
The CHECK has been changed to DCHECK, so the EXPECT_DEATH now only
passes in DEBUG build
Reviewed By: lnicco
Differential Revision: D22067513
fbshipit-source-id: 1a0fa4c3efe1f41c4468d50fe975aed354214d64
Summary:
forgot about this coverage in the original diff introduced the
BufWriter
Reviewed By: mjoras
Differential Revision: D20919832
fbshipit-source-id: 84d960a386d6a0ee91ea84366d369645463d10ad
Summary:
Different Builders now want to have its own way of writing or
appending write buffer. So let builders handle them.
This also add new APIs in BufWriter to copy data from IOBuf/BufQueue directly
into a destination IOBuf without cloning inbetween.
Reviewed By: mjoras
Differential Revision: D20821789
fbshipit-source-id: c0a24eb12378f64cf26c27d4232f610ed80fba84
Summary:
Current Quic BufAppender and folly Cursor have the ability to append
other IOBufs into the targeting IOBuf, which isn't desired in our use case.
This BufWriter only writes, never appends. It copies the data into targeting
IOBuf if a private IOBuf is passed in.
Reviewed By: mjoras
Differential Revision: D20781978
fbshipit-source-id: 4749dfb7e4d518647c3b32c5273338940da0e67f
Summary:
Don't use IOBufQueue for most operations in mvfst and use BufQueue instead. Since BufQueue did not support a splitAtMost, added it in instead.
The only place that we still use IOBufQueue is in crypto because fizz still requires it
Reviewed By: mjoras
Differential Revision: D18846960
fbshipit-source-id: 4320b7f8614f8d2c75f6de0e6b786d33650e9656
Summary:
makes the split and trim functions for buf util batch delete the iobufs
instead of popping them out one by one.
Reviewed By: mjoras
Differential Revision: D18821896
fbshipit-source-id: 6e1543c4c1de298e4677043251ecd8a5601a2557
Summary:
Get rid of IObufQueue usage in the PacketBuilder and replace it with a vanilla IOBuf.
This requires replacing QueueAppender with something else as well, so this diff adds a new class call BufAppender which does exactly the same things as a QueueAppender.
Having a BufAppender will allow us to avoid cloning the stream buffer in the future and avoid a clone during the write path.
Reviewed By: mjoras
Differential Revision: D18673517
fbshipit-source-id: 31fd7758688686371d038111514eb62d6b21672c
Summary:
`IOBufQueue` has some facilities for fast appending to the tail. This is not useful for us in the retransmission buffer usecase, and probably not at all. Flushing the tail cache from the `IOBufQueue` is expensive when we have to shuffle around the retransmission buffer queue on removal.
This diff replaces `IOBufQueue` with a bespoke version that only has some of the functionality.
This also changes the dependent peek APIs to use `IOBuf`s directly.
Reviewed By: siyengar, yangchi
Differential Revision: D18126437
fbshipit-source-id: a2fec0f45a72459855700c605bfd0d863a9067b7