chitralverma opened a new pull request, #9425:
URL: https://github.com/apache/opendal/pull/9425

   # Which issue does this PR close?
   
   Part of #9322 (tracker: #9320).
   
   # Rationale for this change
   
   Node.js cannot compose objects. Only `gcs` composes today. No Node.js caller 
is known. Typical GCS uses:
   - Parallel upload: write the parts with `Promise.all`, then `await 
op.compose(parts, 'upload/video.mp4')` and `await op.remove(parts)`.
   - Compaction: `await op.compose(smallFiles, 'events/2026-11-30.jsonl', { 
ifNotExists: true })`, then remove `smallFiles`.
   - Append: core rejects a `to` that is also a source (`IsSameFile`, 
RFC-8188). Keep the chunks and recompose: `await op.compose(chunks, 
'logs/app.log', { ifVersionMatch: version })` fails with `ConditionNotMatch` if 
another writer recomposed first.
   
   # What changes are included in this PR?
   
   - `compose(sources, to, options?)` returns `Promise<Metadata>`. 
`composeSync` wraps `blocking::Operator::compose_options` (#9423) and returns 
`Metadata`.
   - `sources` is `Array<string | ComposeSource>`. `ComposeSource` is `{ path, 
version?, ifMatch?, ifNotChanged? }`.
   - The generator makes `ComposeOptions` (all 12 fields) and `ComposeSource` 
from core `ComposeOptions` and `ComposeSourceOptions`, with JSDoc in Node.js 
names. `path` is the only binding-only member. `ifNotChanged` takes a binding 
`Metadata`, as in #9420.
   - Not included: the incremental `Composer`, and `Entry` as a source.
   
   # Are there any user-facing changes?
   
   - New methods `compose` and `composeSync`, and new interfaces 
`ComposeOptions` and `ComposeSource`.
   - Type check only: an object that implements every `Operator` member by hand 
must add `compose` and `composeSync`.
   
   Verified: `generated.d.ts` vs `main` only adds lines. On fake-gcs-server, 
through both methods: order and returned length (`[a, a, b]`), destination 
metadata, `IsSameFile`, empty `sources`, the uses above and each JSDoc example 
as written. Request traces show each source and destination option. Examples 
pass `tsc --strict`. Each new test fails under a mutation, such as reversed 
sources or dropped metadata. All `ci_odev` generators, fmt and `git diff 
--exit-code`; dev and Node.js tests and clippy.
   
   Not verified: real GCS (the nightly `gcs` job runs the new suites). 
fake-gcs-server ignores compose conditions and source generations, so 3 of 5 
suite tests fail there.
   
   # Breaking changes
   
   None
   
   # AI Usage Statement
   
   - **Harness:** Claude Code via T3 Code | **Model:** Claude Opus 5.5 | 
**Effort:** xhigh
   - **Role:** Implemented the changes and tests, verified them on 
fake-gcs-server, drafted this text. The author reviews every change and claim.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to