Skip to content

refactor(layers)!: own timeout and retry operations and use the context timer in AIMD - #9577

Merged
Xuanwo merged 3 commits into
mainfrom
xuanwo/9538-operation-types-aimd-executor
Dec 3, 2026
Merged

Xuanwo merged 3 commits into
mainfrom
xuanwo/9538-operation-types-aimd-executor

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #9538.

Rationale for this change

Rust applications currently need types from the storage extension API to configure timeout overrides, implement a retry budget, or supply an AIMD timer. Each layer can expose its own supported operations and use the runtime resources configured on the operator.

What changes are included in this PR?

  • Add TimeoutOperation for per-operation deadlines, including compose, and map Java's existing operation names to it in JNI.
  • Add RetryOperation and use it in RetryBudget and RetryEvent. Compose passes through the retry layer.
  • Use the operator's context executor for AIMD admission timers. Context replay shares the layer's existing budgets and cooldown.

Are there any user-facing changes?

AIMD needs a timer only if a request reaches the head of its FIFO queue and still has to wait for a token or for the cooldown to end. If the context executor supplies no timer in that case, AIMD returns a non-temporary ErrorKind::ConfigInvalid before consuming a token or dispatching the request. Requests that can proceed as soon as they reach the head, and requests that bypass pacing, need no timer.

The Rust upgrade guide covers timeout and retry operation imports and shows how to install a timer-capable executor. An external Rust caller exercised Operator::stat outside Tokio, first with a timerless executor and then after installing CompioExecutor through Operator::with_context.

Breaking changes

Affected packages: core

Migration:

  • Pass a TimeoutOperation variant to TimeoutLayer::with_operation_timeout. Remove overrides for raw::Operation::Info, which has no deadline.
  • Use RetryOperation in RetryBudget::deposit, try_reserve, and release and when matching RetryEvent::op. Import these enums from opendal::layers or their respective layer crates. Include a wildcard arm when matching either enum.
  • Remove calls to AimdLayerBuilder::with_sleep. If you used the hook or relied on the old Tokio fallback for timed waits at the head of the AIMD queue, supply a timer-capable executor with OperationContext::with_executor and Operator::with_context. If the operator uses the process-wide default, install a timer-capable default with Executor::install_default. Custom executors supply timers through Execute::sleep.

AI Usage Statement

  • Harness: Pi via T3 Code. Model: magpie/codex/gpt-6.2-astra. Effort: high. Role: traced the layer contracts and evaluated the API and timer behavior.
  • Harness: Pi via T3 Code. Model: magpie/codex/gpt-6.2-sol. Effort: max. Role: implemented the Rust and JNI changes, updated the migration guide, and verified the affected callers.
  • Harness: Antigravity via T3 Code. Model: gemini-4-neon. Effort: high. Role: copy-edited the PR text and Rust migration guidance.
  • Harness: Pi via T3 Code. Model: magpie/codex/gpt-6.2-sol. Effort: high. Role: independently reviewed the layer changes and verified timer behavior through Operator::stat.

@github-actions github-actions Bot added bindings/java core releases-note/refactor The PR does a refactor on code or has a title that begins with "refactor" size:XL This PR changes 500-999 lines, ignoring generated files. labels Dec 3, 2026
@Xuanwo
Xuanwo merged commit 98d66e6 into main Dec 3, 2026
68 of 69 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/9538-operation-types-aimd-executor branch December 3, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bindings/java breaking-changes core releases-note/refactor The PR does a refactor on code or has a title that begins with "refactor" size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(layers)!: make TimeoutLayer, RetryLayer, and AimdLayerBuilder self-contained without exposing raw types

3 participants