chitralverma opened a new issue, #9316:
URL: https://github.com/apache/opendal/issues/9316

   > This issue was drafted with AI assistance (Claude Code, Claude Opus 5.5) 
and reviewed by the submitter.
   
   ### Feature Description
   
   Expose core's full-file checksum surface (`Metadata::checksum`, 
`WriteOptions::checksum`, and the read/reader/stat `checksum` hints) through 
the generated binding mirrors.
   
   ### Problem and Solution
   
   **What core has** (on `main` at `4ae8e61222`):
   
   - `Metadata::checksum() -> Option<Checksum>`: 
https://github.com/apache/opendal/blob/4ae8e61222e6d282b2a1ec99db4e87dccacf5919/core/core/src/types/metadata.rs#L365
   - `checksum: bool` metadata hints on `ReadOptions` 
(https://github.com/apache/opendal/blob/4ae8e61222e6d282b2a1ec99db4e87dccacf5919/core/core/src/types/options.rs#L383),
 `ReaderOptions` 
(https://github.com/apache/opendal/blob/4ae8e61222e6d282b2a1ec99db4e87dccacf5919/core/core/src/types/options.rs#L543),
 and `StatOptions` 
(https://github.com/apache/opendal/blob/4ae8e61222e6d282b2a1ec99db4e87dccacf5919/core/core/src/types/options.rs#L658)
   - `WriteOptions::checksum: Option<WriteChecksum>`: 
https://github.com/apache/opendal/blob/4ae8e61222e6d282b2a1ec99db4e87dccacf5919/core/core/src/types/options.rs#L845
   
   **What the generators skip:**
   
   - The metadata parser lists `checksum` in `NOT_MIRRORED`, so no generated 
`Metadata` mirror (C, C++, .NET, Java, Node.js, OCaml, Python, Ruby) carries 
it: 
https://github.com/apache/opendal/blob/4ae8e61222e6d282b2a1ec99db4e87dccacf5919/dev/src/generate/metadata.rs#L75
   - The shared options parser lists `("WriteOptions", "checksum")` in 
`NOT_MIRRORED`: 
https://github.com/apache/opendal/blob/4ae8e61222e6d282b2a1ec99db4e87dccacf5919/dev/src/generate/core_options.rs#L106
   - The Java options generator hardcodes `checksum: false` for read, reader, 
and stat: 
https://github.com/apache/opendal/blob/4ae8e61222e6d282b2a1ec99db4e87dccacf5919/dev/src/generate/java.rs#L1648-L1650
   
   **Current binding state:**
   
   - **.NET:** `ReadOptions.Checksum` and `StatOptions.Checksum` are exposed 
and forwarded to core, but with no `Metadata` checksum the hint has no 
observable effect. `WriteOptions` has no checksum.
   - **Java:** no checksum on `ReadOptions`, `ReaderOptions`, `StatOptions`, or 
`WriteOptions`; the JNI layer always passes `checksum: false`.
   - **Python:** a hand-written `checksum: ChecksumAlgorithm` write kwarg 
(https://github.com/apache/opendal/blob/4ae8e61222e6d282b2a1ec99db4e87dccacf5919/bindings/python/python/opendal/options.py#L48,
 parsed at 
https://github.com/apache/opendal/blob/4ae8e61222e6d282b2a1ec99db4e87dccacf5919/bindings/python/src/options.rs#L234)
 maps to `ChecksumAlgo`. It supports only algorithm selection, not 
`Any`/`Fast`/`Expected`, and `Metadata` has no checksum, so callers cannot read 
the verified digest back.
   - **Other generated `Metadata` mirrors:** no checksum surface.
   
   Bindings mirror `Capability::read_with_checksum` and `write_with_checksum` 
(#9182 Phase 5), so callers can detect support but cannot request or observe 
the checksum.
   
   **Proposed direction** (open to maintainer feedback):
   
   1. Teach `dev/src/generate/metadata.rs` to mirror a `Checksum` value 
(algorithm + digest) per binding, then drop `checksum` from its `NOT_MIRRORED` 
list.
   2. Enable the read/reader/stat `checksum` hints in the options generators 
(and remove Java's hardcoded `false`), so the hint becomes observable through 
`Metadata`.
   3. Mirror `WriteOptions::checksum` (`WriteChecksum`) in `core_options.rs` 
and its consumers, and decide whether Python's hand-written `ChecksumAlgorithm` 
form should converge on it.
   
   Each step could land per binding, following the existing generator work.
   
   ### Additional Context
   
   Related: #9122 (generate `Capability` for all bindings), #9129 (generate 
`Metadata` for all bindings), #9182 (RFC-9166 tracking; Phase 5 covers 
capability and error mapping only).
   
   ### Are you willing to contribute to the development of this feature?
   
   - [ ] Yes, I am willing to contribute to the development of this feature.
   


-- 
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