Skip to content

Conversation

@lcian
Copy link
Member

@lcian lcian commented Feb 12, 2026

Add a wrap_stream method on Services to encapsulate the repeated MeteredPayloadStream::from(stream, state.rate_limiter.bytes_accumulator()).boxed() pattern, and introduce a MeteredBody axum extractor that converts request bodies into metered payload streams.

This removes boilerplate from POST/PUT handlers (objects_post, object_put) which no longer need to manually extract Body + State just for metering, and simplifies the GET paths (object_get, batch GET) by replacing inline metering with state.wrap_stream(stream).

Add a `wrap_stream` method on `Services` to encapsulate the repeated
`MeteredPayloadStream::from(stream, state.rate_limiter.bytes_accumulator()).boxed()`
pattern. Introduce a `MeteredBody` axum extractor that converts request
bodies into metered payload streams, removing boilerplate from POST/PUT
handlers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lcian lcian requested a review from a team as a code owner February 12, 2026 13:56
@lcian lcian changed the title ref(server): Add MeteredBody extractor and Services::wrap_stream ref(server): Add MeteredBody extractor and wrap_stream util Feb 12, 2026
lcian and others added 2 commits February 12, 2026 14:59
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member

@jan-auer jan-auer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement!

@lcian lcian merged commit 1d1807f into main Feb 12, 2026
20 checks passed
@lcian lcian deleted the ref/metered-body-extractor branch February 12, 2026 14:36
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.

2 participants