Skip to content

Consider splitting hord-stream/src/stream.rs (2,250 production lines) #7

Description

@perbu

hord-stream/src/stream.rs is 3,523 lines: roughly 2,250 production and 1,273 test.

The tests are not the problem and should not be moved. All six inline #[cfg(test)] modules reach into private items, so Rust gives them nowhere else to live:

  • fullduplex_tests, half_close_tests, split_tests, gather_tests read private fields (send_credits, send_free, peer_split_credits, grant_pending) and call private pump / post_data_message — they test flow-control internals on purpose.
  • negotiate_tests and plan_gather_tests exercise the private functions negotiate_split, plan_gather and next_batch_len.

So this is only about the production half. HordStream is now organised into five documented impl blocks, which gives the same grouping in rustdoc, and those boundaries are the obvious candidate seams if the file is ever split:

  1. construction, handshake and negotiation
  2. completion processing, credit accounting, the recv/send pools (nearly all private)
  3. the non-blocking byte-stream API
  4. one-sided RDMA writes (§7.1–§7.4, §7.7)
  5. event-loop integration and teardown

A split would mean stream/mod.rs plus submodules, with the private fields of HordStream becoming pub(super) or pub(crate) — which widens their visibility beyond the current file-private scope. That trade is the actual decision here, and it may well not be worth making: the file is long but well organised and heavily commented.

Filing it to record the seams and the constraint, not as a recommendation to act.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions