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

   # Which issue does this PR close?
   
   Part of #9321 (tracker: #9320).
   
   # Rationale for this change
   
   Python lacks the remaining core options of step 2, plus restore and deleter 
options. Java #8393 is the cross-binding precedent: its stat must fail once a 
GCS generation changes. Commits are grouped by options struct.
   
   # What changes are included in this PR?
   
   - `StatOptions`: `stat()` takes `if_version_match` and 
`if_version_not_match`. Typical use: re-check that a cached GCS object still 
has the generation that was read.
   - `ReadOptions`: `read()` takes `limit`, the version conditions, and 
`content_length_hint`. `open(path, "rb")` takes all but `limit`, because core 
`ReaderOptions` has no `limit`. Typical uses: read at most a header 
(`limit=4096`) of a file of unknown size; skip the stat of a chunked read with 
the size from `list()`.
   - `DeleteOptions`: `delete()` takes `if_none_match`, the version conditions, 
and `if_not_changed`. `delete_many()` also takes `(path, options)` pairs, so 
each batch entry keeps its own conditions. Typical use: delete listed temp 
files unless rewritten since the listing.
   - `WriteOptions`: `write()` and write-mode `open()` take the version 
conditions and `if_not_changed`. Typical use: optimistic update from a `stat()` 
result.
   - `CopyOptions`: `copy()` takes the 12 remaining fields. Typical uses: 
change `content_type` in place (same `source` and `target`); copy only if the 
target is unchanged.
   - `DeleterOptions`, `RestoreOptions`: `delete_many(concurrent=)` and a new 
`restore(path, version=, if_not_exists=)`.
   - `if_not_changed` takes the `Metadata` that `stat()` or `list()` returns. 
Docs come from core in Python names. Rewrites apply only where core is wrong 
for Python: no copier, `copy()` returns `None`, and `source`/`target` names.
   
   # Are there any user-facing changes?
   
   - All new kwargs are keyword-only. Calls without them behave as before. The 
new `*Kwargs` keys accept `None`, as the runtime does.
   - `read()` raises `ValueError` for `limit` with a positive `prefetch`. 
`open()` raises `TypeError` for `limit`, and for `if_not_changed` in read mode, 
unless the value is `None`.
   - `delete_many()` raises `TypeError` for an unknown key in an entry's 
options, before it deletes anything.
   - `options.py` adds `DeleterKwargs`, `RestoreKwargs`, and `DeleteEntry`.
   
   Verified: the suite, including 30 new sync and async tests, passes on 
SeaweedFS 4.52, versioned Silo, Azurite 3.38.0, and `memory` and `fs` on macOS 
and Linux. `fake-gcs-server` traces show each gcs version condition on the 
wire. Mutating a pass-through in each group fails its tests. `just stub-gen`, 
`lint`, `test-typing`, Sphinx `-W -n`, `dev` tests, and all `ci_odev.yml` 
generators with `git diff --exit-code` pass.
   
   Not verified: real GCS (no credentials; `fake-gcs-server` does not evaluate 
preconditions); AWS S3. On SeaweedFS, a multipart `copy(chunk=...)` resets 
target metadata; this comes from core s3 and exists on `main`.
   
   # 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, audited the request builders 
of each service that advertises these options (no new dropped condition), 
verified the docs on real servers, and 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