Skip to content

feat(iroh-relay): expose Bucket rate-limit primitive#4231

Closed
veeso wants to merge 1 commit into
n0-computer:mainfrom
holochain:feat/expose-bucket
Closed

feat(iroh-relay): expose Bucket rate-limit primitive#4231
veeso wants to merge 1 commit into
n0-computer:mainfrom
holochain:feat/expose-bucket

Conversation

@veeso
Copy link
Copy Markdown

@veeso veeso commented May 5, 2026

Description

Embedders that mount the relay protocol via custom HTTP servers (e.g. axum integration in holochain/kitsune2) cannot use the existing RateLimited<S: AsyncRead> wrapper because their stream layer is already WS-framed by the time the relay handler runs. Exposing Bucket lets these embedders apply Iroh's bucket semantics at the frame layer.

Visibility-only change: Bucket struct, Bucket::new, and Bucket::consume become pub. Fields stay private. InvalidBucketConfig was already pub. Adds rustdocs to satisfy deny(missing_docs).

No behavior change.

Breaking Changes

No, just promoting visibility.

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.

@veeso veeso force-pushed the feat/expose-bucket branch from e094320 to 3d760a9 Compare May 5, 2026 14:08
@veeso veeso marked this pull request as ready for review May 5, 2026 14:08
@dignifiedquire dignifiedquire requested a review from Frando May 5, 2026 15:26
@n0bot n0bot Bot added this to iroh May 5, 2026
@github-project-automation github-project-automation Bot moved this to 🚑 Needs Triage in iroh May 5, 2026
Embedders that mount the relay protocol via custom HTTP servers
(e.g. axum integration in holochain/kitsune2) cannot use the existing
RateLimited<S: AsyncRead> wrapper because their stream layer is already
WS-framed by the time the relay handler runs. Exposing Bucket lets these
embedders apply iroh's bucket semantics at the frame layer.

Visibility-only change: Bucket struct, Bucket::new and Bucket::consume
become pub. Fields stay private. InvalidBucketConfig was already pub.
Adds rustdocs to satisfy deny(missing_docs).

No behavior change.
@veeso veeso force-pushed the feat/expose-bucket branch from 3d760a9 to 4ded719 Compare May 6, 2026 09:09
@Frando
Copy link
Copy Markdown
Member

Frando commented May 6, 2026

Hi, this looks reasonable. I'm a little wary with exposing so-far internal APIs without having a clear idea how it's being used - could you give a short example where in your relay embedding you'd use this?

We recently merged an integration test for embedding iroh-relay in axum. Could you maybe add the bucketing to the example?

If not feasable, maybe you could post an example here so that I can see how it's being used.

@veeso
Copy link
Copy Markdown
Author

veeso commented May 6, 2026

Hello, we are using this in this PR on our relay server for rate limiting: holochain/kitsune2#533 at crates/bootstrap_srv/src/iroh_relay_axum.rs

@dignifiedquire dignifiedquire moved this from 🚑 Needs Triage to 👀 In review in iroh May 7, 2026
@dignifiedquire dignifiedquire added this to the v1.0.0-rc.0 milestone May 7, 2026
Copy link
Copy Markdown
Member

@Frando Frando left a comment

Choose a reason for hiding this comment

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

Needs rebase / branch update

@dignifiedquire
Copy link
Copy Markdown
Contributor

need to land this for the release so created #4242

@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in iroh May 7, 2026
dignifiedquire added a commit that referenced this pull request May 7, 2026
> Updated version of #4231 

Embedders that mount the relay protocol via custom HTTP servers (e.g.
axum integration in holochain/kitsune2) cannot use the existing
RateLimited<S: AsyncRead> wrapper because their stream layer is already
WS-framed by the time the relay handler runs. Exposing Bucket lets these
embedders apply iroh's bucket semantics at the frame layer.

Visibility-only change: Bucket struct, Bucket::new and Bucket::consume
become pub. Fields stay private. InvalidBucketConfig was already pub.
Adds rustdocs to satisfy deny(missing_docs).

No behavior change.

Co-authored-by: Christian Visintin <christian.visintin@veeso.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants