Repository navigation
Return a WireRequest that borrows nothing, and read it with its buffer - #54
Open
tiptenbrink wants to merge 2 commits into
Open
tiptenbrink wants to merge 2 commits into
tiptenbrink wants to merge 2 commits into
Conversation
The encode_* functions, s3::set_signature and sigv4::sign return a Placement, which borrows nothing, and Placement::request reads the WireRequest from the buffer. A request no longer lends back content passed as Payload::Slice: it states the length, and the host sends the bytes. s3::Unsigned loses its lifetime, and the span accessors move from WireRequest to Placement. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Placement is gone: every encoder, s3::set_signature and sigv4::sign return a WireRequest of spans, and its url, headers, head and payload take the buffer it was written into. The hosts pass a request and its buffer together, as the C ABI already does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #53. Every function that writes a request now returns a
WireRequestthat borrows nothing. It holds the method, and where the URL, head, field lines and body are in the buffer. Each part is read by passing that buffer. A host that keeps its buffer can grow it and write a request again without converting anything:Before, an encoder returned a
WireRequest<'r>that borrowed the buffer, and the caller's content. A host that grew its buffer had to add.map(|request| request.placement())to each call, and turn thePlacementback into a request withplacement.request(&buf).What changes
WireRequesthas no lifetime and isCopy.url(&buf),headers(&buf),head(&buf)andpayload(&buf)read its parts from the buffer it was written into. The span accessors (url_span,head_span,fields_span,body_span) stay, with a newcontent_len.PlacementandWireRequest::placementare gone. The C ABI already had only the span struct,borink_wire_request, so the Rust and C types now match.azure::encode_*,s3::set_signatureandsigv4::signreturns aWireRequest. An S3 encoder still returns ans3::Unsigned, which no longer has a lifetime. Itscanonical(&buf)andbody(&buf)already read the buffer the same way.Payload::Slice. It states the content's length asPayload::Streamed, and the host sends the bytes it holds. A body that the crate wrote, such as a block list or a list of parts, is still lent from the buffer. A request without content still has an emptyPayload::Slice.Callers
sendtakes the request and its buffer.(WireRequest, &[u8])pair. It also names each Azure encoder once: one closure sizes the buffer and writes the request.WireRequestto its request struct. The C types and the header are unchanged.azure_put's content test now expects held and streamed content to give the same request.Not in this PR: object-storage.dev's replay and benchmarks, which read
WireRequestthrough the borrowing accessors. They move to the new readers when they next take this crate.Checked locally:
cargo fmt --check, clippy on all targets and features, every workspace test, the docs with-D warnings, and the link check without an allocator.