Skip to content

netlib v2 greenfield#3

Draft
retretx wants to merge 106 commits into
masterfrom
cursor/netlib-2-greenfield-3df4
Draft

netlib v2 greenfield#3
retretx wants to merge 106 commits into
masterfrom
cursor/netlib-2-greenfield-3df4

Conversation

@retretx

@retretx retretx commented Jul 8, 2026

Copy link
Copy Markdown
Owner

netlib v2 greenfield

C++26 module-first architecture

  • Canonical implementation moved to modules/cxx/**/*.cppm; compatibility headers now contain imports only
  • Added explicit hierarchy: netlib.core.*, netlib.io.*, netlib.io.coro, and backend modules netlib.platform.uring|rio|poll
  • Added umbrella import netlib; and CMake target netlib::modules
  • CMake 3.30+, Ninja, and a C++26 modules toolchain are enforced
  • Core module provider is built with -nostdinc++
  • Install/export ships CXX_MODULES file sets; direct-import and compatibility-header external consumers are tested
  • Local CI now builds C++26 modules, runs runtime smoke/CTest, installs the package, and rebuilds consumer BMIs

Async UDP and benchmarks

  • Linux: native io_uring RECVMSG / SENDMSG
  • Windows: RIO ReceiveEx / SendEx with WSAPoll software fallback
  • macOS: nonblocking recvfrom / sendto via poll_engine
  • Added coroutine UDP APIs, examples, tests, and v2_udp_bench
  • GitHub Actions removed in favor of ./scripts/ci.sh

Verification

  • ./scripts/ci.sh clang
  • Full v2 test suite and TCP/UDP smoke tests
  • C++26 module build with and without coroutine module
  • Installed direct module consumer and compatibility-header consumer
Open in Web Open in Cursor 

- Add netlib::span, text_view, result, optional, duration, inplace_vector, ring_buffer
- Add null_logger and io::mock_engine for zero-vtable testing
- CMake netlib::core target with nostdinc++ compile gate (netlib_core_nostd_check)
- v2 unit tests with Catch2 in runner only; v1 tests behind NETLIB_BUILD_V1_TESTS
- Project rules (.cursor/rules/netlib-2.mdc) and docs/NOSTDLIB.md
- Bump project version to 2.0.0; simplify CI for v2 scaffold

Co-authored-by: Nikita <retretx@gmail.com>
@cursor

cursor Bot commented Jul 8, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

cursoragent and others added 24 commits July 8, 2026 22:38
- Add buffer_registry for consumer-owned span regions
- Add netlib_platform_uring static lib with raw io_uring syscalls
- io_uring_engine: open/submit/poll for READ/WRITE ops
- Integration test: socketpair read via io_uring
- Rules: do not create branches/PRs without user request

Co-authored-by: Nikita <retretx@gmail.com>
… of cursor rules)

Co-authored-by: Nikita <retretx@gmail.com>
- Extend io_uring_engine with register_buffers, CONNECT/ACCEPT ops
- Pack op_kind into user_data for correct completion dispatch
- Add io_context template and Linux platform alias
- Implement socket_posix TCP helpers (bind ephemeral, connect)
- Add mock_engine stubs for open/register_buffers
- Integration tests: buffer registration, TCP echo via READ/WRITE

Co-authored-by: Nikita <retretx@gmail.com>
- submission: reg_index/offset/length + read_fixed_op/write_fixed_op
- io_uring_engine: IORING_OP_READ/WRITE_FIXED, accept addr2, accept fd in completion
- poll: min_complete=0 to avoid indefinite blocking
- Tests: async ACCEPT, CONNECT (SKIP if unsupported), registered buffer echo

Co-authored-by: Nikita <retretx@gmail.com>
- io::byte_stream: consumer-owned buffer cursor (read/write positions)
- io::socket: non-owning fd handle with read/write submission helpers
- io::pipe: operator| for read_into, write_from, echo_to chains
- run_read/run_write/run_echo helpers with poll loop
- tests/v2/socket_tests: mock + TCP integration via pipe API

Co-authored-by: Nikita <retretx@gmail.com>
- io::tcp_acceptor: RAII listen socket, bind_loopback_ephemeral(out)
- resolve_host: IPv4 literal fast-path + getaddrinfo cold path
- io::connect(sock, host, port): blocking TCP connect by hostname
- pipe::accept_peer / run_accept for async ACCEPT via operator|
- Tests: mock accept, DNS resolve, acceptor + connect integration

Co-authored-by: Nikita <retretx@gmail.com>
- socket::connect_submission, pipe::connect_to / connect_host
- make_connect resolves host then stages CONNECT submission
- run_connect and connect_async poll for connect completion
- Tests: mock connect, accept+async connect integration (SKIP if unsupported)

Co-authored-by: Nikita <retretx@gmail.com>
- include/netlib/io/coro.hpp вне nostd modules: read/write/connect/accept awaitables
- sync_wait(io_context, io_task) с poll-драйвером для mock/io_uring
- NETLIB_ENABLE_COROUTINES по умолчанию ON при поддержке toolchain
- 4 теста в tests/v2/coro_tests.cpp (mock_engine)

Co-authored-by: Nikita <retretx@gmail.com>
- pipe: staged_handshake, run_handshake (accept+connect submit, joint poll)
- pipe: make_handshake, handshake_async(host) cold-path resolve
- coro: handshake_awaitable с session::handshake_wait и pump_handshake
- тесты mock + linux integration + coro handshake

Co-authored-by: Nikita <retretx@gmail.com>
- platform/windows: rio_engine (RIO probe, CQ create, software completion fallback)
- socket_winsock: tcp_socket, resolve, tcp_acceptor bind/listen
- connect.hpp + io_context platform alias for NETLIB_PLATFORM_WINDOWS
- CMake netlib::platform_rio (ws2_32, mswsock), tests/v2/rio_tests.cpp (WIN32)

Co-authored-by: Nikita <retretx@gmail.com>
…actor

- session::multi_wait заменяет handshake_wait (до 8 параллельных op)
- multi_op::descriptor для accept/connect/read/write
- when_all(ctx, op...) + when_all_result<N>
- handshake_awaitable построен поверх when_all_2
- тест parallel reads (4+8 bytes)

Co-authored-by: Nikita <retretx@gmail.com>
- parallel_op + parallel_slot_result (accept/connect/read/write)
- run_when_all(ctx, ops[N], out[N]) с poll_parallel
- run_handshake рефакторен через run_when_all
- тест parallel reads (4+8 bytes)

Co-authored-by: Nikita <retretx@gmail.com>
- Probe IORING_OP_CONNECT and registered I/O at engine open
- Fallback run_connect/run_handshake to blocking TCP when async connect unavailable
- blocking_connect temporarily clears O_NONBLOCK for libc connect on Linux
- pipe::parallel_op alias in coro multi_op; capability test + CI coroutines

Co-authored-by: Nikita <retretx@gmail.com>
…rts_async_connect

- connect_awaitable и handshake_awaitable делегируют blocking path
- Linux coro integration test с io_uring + blocking connect fallback

Co-authored-by: Nikita <retretx@gmail.com>
- resolve_submission: READ/WRITE_FIXED → READ/WRITE через buffer_registry при !supports_registered_io
- Пропуск io_uring_register_buffers если fixed ops недоступны
- buffer_registry::slice, pipe read_fixed_into/write_fixed_from + run_*_fixed
- Тесты: echo через fallback, invalid reg_index, pipe mock

Co-authored-by: Nikita <retretx@gmail.com>
- read_fixed_async / write_fixed_async поверх staged_read/write_fixed
- pipe staged_echo_fixed: read_fixed_into | echo_to + run_echo_fixed
- Тесты: mock pipe/coro, io_uring pipe echo через span fallback

Co-authored-by: Nikita <retretx@gmail.com>
…robe

- coro echo_fixed_async делегирует pipe::run_echo_fixed
- parallel_op/multi_op read_fixed/write_fixed для when_all
- Windows: RIOCreateRequestQueue при probe, request_queue_ready()
- Тесты: coro when_all fixed, pipe run_when_all fixed

Co-authored-by: Nikita <retretx@gmail.com>
- coro when_all read_fixed и echo_fixed_async на io_uring + span fallback
- Windows RIORegisterBuffer/RIODeregisterBuffer, registered_buffer_count()
- rio_tests: register_buffers через io_context

Co-authored-by: Nikita <retretx@gmail.com>
…n_all io_uring test

- session::sequential_step для цепочки read_fixed → write_fixed без sync run_echo_fixed
- pipe run_when_all parallel read_fixed на io_uring + span fallback

Co-authored-by: Nikita <retretx@gmail.com>
…helpers

- io_task_awaiter с continuation для вложенных coro-задач
- echo_async: sequential read→write через byte_stream
- detail::sequential_arm/finish — DRY для echo_fixed/echo
- Тесты: echo_async, nested io_task co_await

Co-authored-by: Nikita <retretx@gmail.com>
…ll stream reads

- coro: echo_async TCP + when_all stream reads на io_uring
- pipe: run_echo TCP + run_when_all stream reads на io_uring

Co-authored-by: Nikita <retretx@gmail.com>
- connect_host_awaitable / handshake_host_awaitable с cold-path resolve
- Тесты mock + io_uring handshake(host); coro:: квалификация vs pipe::
- CHANGELOG: coro layer, capability probe, span fallback, RIO, CI

Co-authored-by: Nikita <retretx@gmail.com>
- Rename pipe sync helpers to run_connect_host/run_handshake_host to avoid
  ambiguity with coro::connect_async/handshake_async
- Windows rio_engine: RIOReceive/RIOSend for registered fixed I/O, per-socket
  request queue pool, hybrid hardware/software poll
- Update docs/COROUTINES.md with v2 pipe/coro API section

Co-authored-by: Nikita <retretx@gmail.com>
- tcp_acceptor::bind_host + platform bind_ipv4 (Linux/Windows)
- pipe::run_accept_bind_host, coro::accept_bind_async
- detail::sequential_awaitable_base CRTP for echo awaitables
- Tests: bind_host, accept_bind_async; docs + CHANGELOG

Co-authored-by: Nikita <retretx@gmail.com>
@cursor cursor Bot changed the title netlib 2.0 Phase 0: core primitives without C++ stdlib netlib v2 greenfield — io_uring + coro + RIO milestone Jul 9, 2026
cursoragent and others added 3 commits July 9, 2026 00:38
- sequential2_awaitable, read_then_write_async/fixed_async, sequential_async
- Windows RIO: on-demand span buffer registration (submit_rio_span)
- Linux integration: bind_host + async accept + client connect
- Tests + docs/COROUTINES.md + CHANGELOG

Co-authored-by: Nikita <retretx@gmail.com>
- sequentialN_awaitable + sequential_chain builder (2..8 steps)
- echo_async/echo_fixed_async delegate to read_then_write_*
- commit_write_stream on sequential2 for stream echo semantics
- coro tests: 3-step chain, handshake after bind_host, when_all accept+connect

Co-authored-by: Nikita <retretx@gmail.com>
- coro::accept_connect_async with blocking-connect fallback (handshake delegate)
- pipe::run_accept_connect sync alias
- sequential_chain::defer_write_after_read for dynamic write after read
- docs/EXAMPLES.md v2 section; accept_connect io_uring integration test

Co-authored-by: Nikita <retretx@gmail.com>
cursoragent and others added 11 commits July 9, 2026 14:35
- mock echo_peer/accept_echo_once via software completions
- real TCP client echo round trip and echo_async via poll_engine
- extend shared coro test helpers for NETLIB_PLATFORM_POSIX

Co-authored-by: Nikita <retretx@gmail.com>
io_context.hpp pulls io_uring/RIO engine headers on Linux/Windows; add the
same POSIX branch so v2_echo and coro.hpp see poll_engine via the include chain.

Co-authored-by: Nikita <retretx@gmail.com>
blocking_tcp_client_then_cancel used Windows path on Darwin; extend Linux
branch to NETLIB_PLATFORM_POSIX. Fix typo close_fd in posix_poll_tests.

Co-authored-by: Nikita <retretx@gmail.com>
Extend LINUX||WINDOWS blocking accept/connect/rw guards to POSIX and
enable would_block retry for poll_engine (fixes v2_echo smoke hang).

Co-authored-by: Nikita <retretx@gmail.com>
Raw read() on O_NONBLOCK client fd returns EAGAIN on Darwin before echo
reply is ready; blocking_read_some temporarily clears nonblocking.

Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
- Extend v2_echo_bench for NETLIB_PLATFORM_POSIX (poll_engine)
- benchmarks/CMakeLists: Darwin backend alongside io_uring/RIO
- CI macOS: NETLIB_BUILD_BENCHMARKS + smoke v2_echo_bench 10 iters
- Docs: BENCHMARKS, PLATFORMS, CMAKE_OPTIONS, CHANGELOG

Co-authored-by: Nikita <retretx@gmail.com>
- op_kind recvfrom/sendto, peer_addr in submission, socket helpers
- udp_pipe.hpp: run_recvfrom, run_sendto, run_udp_echo
- socket_posix: udp_socket, blocking/nonblocking datagram I/O
- poll_engine: async recvfrom/sendto for live UDP sockets
- io_uring: blocking UDP syscalls in pipe (datagram sockets)
- tests/v2/udp_tests: mock + real loopback ping-pong
- examples/v2_udp_echo; CI smoke Linux gcc + macOS

Co-authored-by: Nikita <retretx@gmail.com>
- recvfrom_async, sendto_async, send_datagram_async, udp_echo_datagram_async
- blocking UDP fallback in await_suspend for io_uring and poll_engine
- fix double commit_read: blocking_recvfrom no longer commits (like blocking_read_some)
- coro tests: mock_engine recvfrom/sendto + real loopback udp_echo
- docs/COROUTINES.md: UDP awaitables table

Co-authored-by: Nikita <retretx@gmail.com>
- Delete .github/workflows/ci.yml
- scripts/ci.sh: configure, build, nostd gate, v2 smoke, ctest (gcc/clang/all)
- Docs: DEVELOPMENT, PLATFORMS, CMAKE_OPTIONS, TESTING, README, CHANGELOG

Co-authored-by: Nikita <retretx@gmail.com>
@cursor cursor Bot changed the title netlib v2 greenfield — io_uring + coro + RIO milestone netlib v2 greenfield Jul 13, 2026
cursoragent and others added 18 commits July 13, 2026 00:47
- coro::udp_echo_loop_async(stop_token, max_datagrams)
- examples: v2_udp_echo_server_coro, v2_udp_echo_client_coro
- coro tests: max datagrams + pre-cancelled stop
- scripts/ci.sh: smoke coro UDP; docs/EXAMPLES, COROUTINES, CHANGELOG

Co-authored-by: Nikita <retretx@gmail.com>
- socket_winsock: udp_socket, blocking_recvfrom/sendto, is_datagram_socket
- udp_pipe + coro: rio_engine blocking UDP (like io_uring on Linux)
- v2_udp_echo examples build on Windows (sync + coro)
- ci.sh: fuser cleanup before TCP smoke; docs/EXAMPLES, CHANGELOG

Co-authored-by: Nikita <retretx@gmail.com>
- rio_engine: software recvfrom/sendto + WSAPoll; hardware datagram via Ex APIs
- udp_socket: WSA_FLAG_REGISTERED_IO for RIO request queues
- Remove rio_engine blocking UDP bypass in udp_pipe/coro
- rio_tests + coro: UDP loopback via rio_engine
- docs: PLATFORMS, EXAMPLES, CHANGELOG

Co-authored-by: Nikita <retretx@gmail.com>
- io_uring_engine: prep_recvfrom/sendto with msghdr slots, probe supports_async_udp
- pack_user_data_slot for in-flight msg slot tracking
- Remove blocking UDP bypass from udp_pipe (all engines submit+poll)
- coro: blocking UDP only for macOS poll_engine
- uring_tests: RECVMSG/SENDMSG + run_udp_echo async path
- docs: PLATFORMS, EXAMPLES, CHANGELOG

Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
Co-authored-by: Nikita <retretx@gmail.com>
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