Skip to content

refactor(fast_io): decompose io_uring/registered_buffers into submodules (LoC audit)#4310

Merged
oferchen merged 1 commit into
masterfrom
refactor/decompose-registered-buffers
May 17, 2026
Merged

refactor(fast_io): decompose io_uring/registered_buffers into submodules (LoC audit)#4310
oferchen merged 1 commit into
masterfrom
refactor/decompose-registered-buffers

Conversation

@oferchen
Copy link
Copy Markdown
Owner

Summary

  • Split crates/fast_io/src/io_uring/registered_buffers.rs (1607 lines, 147% over the LoC audit cap) into focused submodules under registered_buffers/.
  • New layout:
    • mod.rs (105 lines) - module docs, MAX_REGISTERED_BUFFERS, page_size(), public re-exports.
    • registry.rs (407 lines) - RegisteredBufferGroup registration logic, atomic free-bitset slot allocator, RegisteredBufferSlot handle, Drop contract.
    • stats.rs (8 lines) - re-exports the RegisteredBufferStats/RegisteredBufferStatus telemetry types from io_uring_common.
    • submit.rs (260 lines) - submit_read_fixed_batch, submit_write_fixed_batch, RegisteredBufferSlotInfo DTO.
    • tests.rs (882 lines) - unit tests for registry, slot lifecycle, submit helpers, telemetry, and constrained-environment Drop coverage.
  • No public API change. Every cross-module reference (file_reader, file_writer, shared_ring, and the integration test in crates/fast_io/tests/iouring_fixed_batch_short_reads.rs) keeps resolving through the existing re-export surface in io_uring/mod.rs.

Test plan

  • CI: fmt + clippy on the workspace.
  • CI: cargo nextest run -p fast_io --features io_uring on Linux.
  • CI: Windows / macOS / Linux musl stable matrices (non-Linux stubs unchanged).
  • CI: tools/enforce_limits.sh confirms every new file is under cap.

The monolithic 1607-line file mixed the registration coordinator,
slot allocator, telemetry, batch submit helpers, and tests. Split
into focused submodules under registered_buffers/ to bring each
file under the LoC audit cap and clarify ownership of each concern.

No public API changes - external imports (file_reader, file_writer,
shared_ring, integration tests) continue to resolve through the
re-export surface in mod.rs.
@oferchen oferchen merged commit 9b313bb into master May 17, 2026
3 of 14 checks passed
oferchen added a commit that referenced this pull request May 17, 2026
…ern (#4320)

The post-#4310 tests.rs at 882 lines exceeded the 650-line cap. Split
into a tests/ directory grouped by concern, each file well under cap:

- tests/mod.rs (39) - shared try_ring / try_group helpers and module decls.
- tests/registry.rs (113) - page size, validation guards, slot allocator.
- tests/submit.rs (179) - submit_read/write_fixed_batch helpers.
- tests/stats.rs (141) - acquire/miss counters and snapshot semantics.
- tests/status.rs (49) - try_new_with_status outcome reporting.
- tests/drop_contract.rs (309) - Drop semantics and constrained-env coverage
  for the PR #4022 / task #2118 fixed-buffer invariants audit.

The try_ring / try_group helpers replace the repeated match-or-return
boilerplate that handled environments where io_uring is unavailable
(CI sandboxes, seccomp, kernel < 5.6).

No behavioural change; test coverage is preserved.
oferchen added a commit that referenced this pull request May 18, 2026
…les (#4310)

The monolithic 1607-line file mixed the registration coordinator,
slot allocator, telemetry, batch submit helpers, and tests. Split
into focused submodules under registered_buffers/ to bring each
file under the LoC audit cap and clarify ownership of each concern.

No public API changes - external imports (file_reader, file_writer,
shared_ring, integration tests) continue to resolve through the
re-export surface in mod.rs.
oferchen added a commit that referenced this pull request May 18, 2026
…ern (#4320)

The post-#4310 tests.rs at 882 lines exceeded the 650-line cap. Split
into a tests/ directory grouped by concern, each file well under cap:

- tests/mod.rs (39) - shared try_ring / try_group helpers and module decls.
- tests/registry.rs (113) - page size, validation guards, slot allocator.
- tests/submit.rs (179) - submit_read/write_fixed_batch helpers.
- tests/stats.rs (141) - acquire/miss counters and snapshot semantics.
- tests/status.rs (49) - try_new_with_status outcome reporting.
- tests/drop_contract.rs (309) - Drop semantics and constrained-env coverage
  for the PR #4022 / task #2118 fixed-buffer invariants audit.

The try_ring / try_group helpers replace the repeated match-or-return
boilerplate that handled environments where io_uring is unavailable
(CI sandboxes, seccomp, kernel < 5.6).

No behavioural change; test coverage is preserved.
oferchen added a commit that referenced this pull request May 18, 2026
…les (#4310)

The monolithic 1607-line file mixed the registration coordinator,
slot allocator, telemetry, batch submit helpers, and tests. Split
into focused submodules under registered_buffers/ to bring each
file under the LoC audit cap and clarify ownership of each concern.

No public API changes - external imports (file_reader, file_writer,
shared_ring, integration tests) continue to resolve through the
re-export surface in mod.rs.
oferchen added a commit that referenced this pull request May 18, 2026
…ern (#4320)

The post-#4310 tests.rs at 882 lines exceeded the 650-line cap. Split
into a tests/ directory grouped by concern, each file well under cap:

- tests/mod.rs (39) - shared try_ring / try_group helpers and module decls.
- tests/registry.rs (113) - page size, validation guards, slot allocator.
- tests/submit.rs (179) - submit_read/write_fixed_batch helpers.
- tests/stats.rs (141) - acquire/miss counters and snapshot semantics.
- tests/status.rs (49) - try_new_with_status outcome reporting.
- tests/drop_contract.rs (309) - Drop semantics and constrained-env coverage
  for the PR #4022 / task #2118 fixed-buffer invariants audit.

The try_ring / try_group helpers replace the repeated match-or-return
boilerplate that handled environments where io_uring is unavailable
(CI sandboxes, seccomp, kernel < 5.6).

No behavioural change; test coverage is preserved.
@oferchen oferchen deleted the refactor/decompose-registered-buffers branch May 19, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant