Skip to content

Conversation

@vinniefalco
Copy link
Member

@vinniefalco vinniefalco commented Jan 21, 2026

Summary by CodeRabbit

  • New Features

    • Added a type-erased io_buffer_param for efficient, zero-allocation buffer handling at I/O boundaries.
  • Refactor

    • Updated stream, socket, and SSL implementations to accept the new buffer parameter for read/write operations.
  • Tests

    • Added comprehensive unit tests covering many buffer types, sequences, zero-byte cases, and pass-by-value/reference scenarios.
  • Documentation

    • Updated guide examples and includes to use the new buffer parameter.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Warning

Rate limit exceeded

@vinniefalco has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 37 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 361750f and 9d462b9.

📒 Files selected for processing (13)
  • doc/modules/ROOT/pages/guide/buffers.adoc
  • include/boost/corosio/io_buffer_param.hpp
  • include/boost/corosio/io_stream.hpp
  • include/boost/corosio/read.hpp
  • include/boost/corosio/socket.hpp
  • include/boost/corosio/write.hpp
  • src/corosio/src/detail/epoll/sockets.hpp
  • src/corosio/src/detail/iocp/sockets.cpp
  • src/corosio/src/detail/iocp/sockets.hpp
  • src/corosio/src/test/mocket.cpp
  • src/openssl/src/openssl_stream.cpp
  • src/wolfssl/src/wolfssl_stream.cpp
  • test/unit/io_buffer_param.cpp
📝 Walkthrough

Walkthrough

Adds a new type-erased buffer helper boost::corosio::io_buffer_param, replaces includes and all capy::buffer_param usages with io_buffer_param across public I/O interfaces, backends, encryption streams, tests, and docs.

Changes

Cohort / File(s) Summary
New buffer parameter type
include/boost/corosio/io_buffer_param.hpp
Adds boost::corosio::io_buffer_param: a zero-heap, type-erased buffer-sequence wrapper with a templated constructor and copy_to API; includes lifetime/safety docs and examples (+384/-0).
Public I/O interfaces
include/boost/corosio/io_stream.hpp
Replaced include and changed virtual signatures: read_some/write_some now accept io_buffer_param instead of capy::buffer_param (+3/-3).
Header includes updated
include/boost/corosio/read.hpp, include/boost/corosio/write.hpp, include/boost/corosio/socket.hpp
Switched include from boost/capy/buffers/buffer_param.hpp to boost/corosio/io_buffer_param.hpp (minor include edits).
Backend socket implementations
src/corosio/src/detail/epoll/sockets.hpp, src/corosio/src/detail/iocp/sockets.hpp, src/corosio/src/detail/iocp/sockets.cpp
Updated read_some/write_some declarations and definitions to use io_buffer_param (signature changes only).
Encryption stream overrides
src/openssl/src/openssl_stream.cpp, src/wolfssl/src/wolfssl_stream.cpp
Updated read_some/write_some override signatures to accept io_buffer_param (parameter-type changes only).
Test/mock updates
src/corosio/src/test/mocket.cpp
Updated mock mocket_impl read_some/write_some overrides to use io_buffer_param (signature-only changes).
Unit tests
test/unit/io_buffer_param.cpp
New comprehensive unit tests exercising io_buffer_param copy semantics across many buffer types, limits, and edge cases (+~442/-0).
Documentation
doc/modules/ROOT/pages/guide/buffers.adoc
Updated heading, example signature, and include path to reference io_buffer_param and new header (+3/-3).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller as "Caller / Coroutine"
  participant IOStream as "boost::corosio::io_stream_impl"
  participant IOParam as "io_buffer_param"
  participant OS as "Platform IO (epoll/iocp/SSL)"

  Caller->>IOStream: call read_some(coroutine, exec, io_buffer_param, ...)
  IOStream->>IOParam: io_buffer_param.copy_to(dest, n)
  IOParam-->>IOStream: fills platform-native buffers (count)
  IOStream->>OS: submit read/write with native buffers
  OS-->>IOStream: completion (bytes, error)
  IOStream-->>Caller: resume coroutine with result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I found a tiny wrapper neat and trim,
It hops through calls both bright and prim,
No heap, just stacks and clever hops,
From streams to sockets it gently drops,
The rabbit cheers: "Buffers — trimmed to slim!"

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: moving/introducing io_buffer_param into the Boost.Corosio namespace, which is the core objective reflected across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@cppalliance-bot
Copy link

cppalliance-bot commented Jan 21, 2026

An automated preview of the documentation is available at https://43.corosio.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-01-21 02:58:06 UTC

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@doc/modules/ROOT/pages/guide/buffers.adoc`:
- Around line 163-171: Update the section header to match the renamed type:
change the header text "buffer_param" to "io_buffer_param" so it aligns with the
code sample and description; look for the header line that currently reads "==
buffer_param" and replace it with "== io_buffer_param" to keep the doc
consistent with the io_buffer_param class shown in the example.

In `@test/unit/io_buffer_param.cpp`:
- Around line 403-408: The comment incorrectly says "temporary" while code
passes the lvalue arr to acceptByConstRef; either update the comment to reflect
that an lvalue is passed or change the call to pass an actual temporary to
exercise the temporary-conversion path (e.g., construct and pass a temporary
std::array<capy::const_buffer,2> inline instead of the arr variable). Ensure you
still create the two capy::const_buffer elements and assert via BOOST_TEST_EQ(n,
2) after calling acceptByConstRef to preserve the test intent.
🧹 Nitpick comments (3)
include/boost/corosio/read.hpp (1)

16-16: Same consideration as write.hpp regarding include necessity.

Similar to write.hpp, this file doesn't appear to use io_buffer_param directly. The type is used internally by io_stream::read_some. Consider removing if not needed for direct use.

include/boost/corosio/write.hpp (1)

16-16: Remove the redundant io_buffer_param.hpp include.

The io_buffer_param header is not directly used in this file—the write() function template uses ConstBufferSequence and consuming_buffers directly. Since io_stream.hpp (included on line 14) already includes io_buffer_param.hpp, this include is transitive and unnecessary. Removing it reduces header coupling and makes the dependency chain explicit.

test/unit/io_buffer_param.cpp (1)

24-37: Consider a tiny helper to reduce repeated copy_to assertions.

The copy-to-assert pattern is repeated across many tests; a small helper (e.g., assert_copy_to(...)) would reduce duplication and make future changes easier.

@vinniefalco vinniefalco merged commit 9d462b9 into cppalliance:develop Jan 21, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants