Skip to content

Give the ureq host clients that keep templates, a buffer and a key - #53

Open
tiptenbrink wants to merge 1 commit into
masterfrom
ureq-host-clients
Open

tiptenbrink wants to merge 1 commit into
masterfrom
ureq-host-clients

Conversation

@tiptenbrink

Copy link
Copy Markdown
Collaborator

The ureq host wrote a fresh template and a fresh buffer for every request, and built a new ureq agent each time. It encoded each request twice: once into an empty buffer to learn its size, and once for real. It now has a client per provider that keeps what a request can reuse.

  • azure::Blobs and s3::Objects write the template of each kind of request (get, put, delete, list) once, in new. The list options are given there, since the list template depends on them.
  • Every request is written into one buffer that the client keeps. grown_to_fit writes into it as it is, and grows it and writes again only on Error::Capacity. Once the buffer fits the longest request, each request is encoded once.
  • A request is kept as a Placement while the buffer may grow, and read back with placement.request(&buf). That drops the borrow of the caller's content, so the puts now pass their content to send themselves.
  • Each client sends with one agent, which keeps its connections.
  • s3::Objects derives the SigV4 signing key on the first request of each UTC day and keeps it. A unit test checks that a kept key signs for the rest of its day and that the next day's key is derived again.

The examples and the loopback tests make a client once and call its methods. azure_put, which calls the proto directly, is unchanged.

Not in this PR: encoders that return a Placement themselves, which would remove the .map(|request| request.placement()) at each call.

azure::Blobs and s3::Objects write each template once, write every request into one buffer they grow only when a request does not fit, and send with one agent. Requests are kept as a Placement, so the buffer can grow and be written again; puts now send their content themselves.
s3::Objects derives the SigV4 signing key once per UTC day.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant