-
Notifications
You must be signed in to change notification settings - Fork 28
feat(stabilization)!: bytesbuf_io 1.0 #644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # Stabilization Notes | ||
|
|
||
| These notes capture the pending decisions for stabilizing `bytesbuf_io`. They | ||
| describe proposals under review, not a finalized stable API. | ||
|
|
||
| ## Proposed stable boundary | ||
|
|
||
| - Keep owned buffers as the fundamental I/O abstraction. Native asynchronous I/O | ||
| may retain memory for the entire operation, which cannot be represented safely by | ||
| an API based only on borrowed slices. | ||
| - Stabilize the core `Read` and `Write` traits after their required methods and | ||
| result types have been reviewed. | ||
| - Allow stable downstream crates to expose approved `bytesbuf_io` types in their | ||
| public APIs. | ||
|
|
||
| Extension traits, test utilities, ecosystem adapters, and other convenience APIs | ||
| should remain outside the stable boundary until each surface is reviewed separately. | ||
|
|
||
| ## Trait requirements | ||
|
|
||
| The current `Read` and `Write` traits unconditionally require `HasMemory`, `Memory`, | ||
| and `Debug`, and use `trait_variant` to require `Send` from implementations and | ||
| returned futures. Review each requirement instead of carrying it into the stable API | ||
| by default. Changing these requirements is a breaking API change that must be settled | ||
| before 1.0: | ||
|
|
||
| - Remove `HasMemory`, `Memory`, and `Debug` supertraits where they are not essential | ||
| to the I/O contract. Memory providers can be exposed through separate capabilities | ||
| or adapters when an implementation benefits from endpoint-specific allocation. | ||
| Extension methods that currently rely on these inherited capabilities must be | ||
| adjusted as part of the same decision. | ||
| - Decide whether `Send` is required by the traits, by each returned future, or only | ||
| at usage sites. Removing the current requirement changes guarantees available to | ||
| downstream callers. The stable contract should not impose cross-thread execution | ||
| when an implementation and its caller are both thread-local. | ||
| - Select the concrete error boundary. The associated error type and the crate's | ||
| general-purpose `Error` wrapper must provide predictable composition without | ||
| exposing unstable implementation details. | ||
|
|
||
| ## Read and write operations | ||
|
|
||
| The current read surface includes bounded reads, implementation-selected reads, and | ||
| allocation of a new buffer. Review which operations are fundamental and which can be | ||
| implemented as extensions without losing endpoint-specific efficiency. | ||
|
|
||
| The `(usize, BytesBuf)` read result communicates both progress and ownership but is | ||
| easy to use incorrectly. Consider an intentional result type that names the bytes | ||
| read and returned buffer while preserving efficient ownership transfer. | ||
|
|
||
| The write contract should continue to make full writes explicit. Partial-write, | ||
| flush, shutdown, cancellation, and end-of-stream semantics must be either defined by | ||
| the stable traits or explicitly left to adapters and endpoint-specific APIs. | ||
|
|
||
| ## Ecosystem adapters | ||
|
|
||
| Borrowed-buffer APIs such as Tokio and `futures` I/O should be supported through | ||
| adapters rather than define the fundamental abstraction. Adapter documentation must | ||
| state when data is copied, when an allocation is required, and how cancellation | ||
| returns or releases an owned buffer. | ||
|
|
||
| Dynamic or type-erased adapters should also be evaluated. Stabilization must account | ||
| for their allocation, dispatch, pinning, and error-erasure costs, as well as whether | ||
| they compose with both thread-local and `Send` implementations. | ||
|
|
||
| ## Pending review | ||
|
|
||
| - [ ] Review the trait shape against `arty_io`, TCP, and fetch use cases. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Posted by an AI agent · Non-blocking The Problem Why this matters Suggested fix |
||
| - [ ] Explicitly list every API included in the stable surface. | ||
| - [ ] Resolve the `HasMemory`, `Memory`, and `Debug` supertrait requirements. | ||
| - [ ] Decide where `Send` requirements belong. | ||
| - [ ] Decide the stable I/O error representation. | ||
| - [ ] Confirm which read variants are fundamental. | ||
| - [ ] Decide whether read operations return a named result type. | ||
| - [ ] Define cancellation, end-of-stream, and partial-write semantics. | ||
| - [ ] Document compatibility adapters and their allocation and composition costs. | ||
| - [ ] Confirm stable signatures expose only approved stable types. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Posted by an AI agent · Non-blocking
The stable error boundary does not cover recovery classification
Problem
The stabilization decisions cover the associated error type and wrapper composition, but do not decide whether transient/unavailable classifications and retry-delay hints must survive conversion into the crate error.
Why this matters
Once the traits stabilize, adding a required recovery contract can become a breaking change, while callers cannot reliably drive retries or circuit breakers if wrapping erases that information.
Suggested fix
Add recovery classification and preservation to the error-boundary checklist, including an explicit decision if this lower-level crate intentionally leaves classification to adapters.