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

   # Which issue does this PR close?
   
   Part of #9316.
   
   # Rationale for this change
   
   Python callers can select CRC32C when writing an object. Reading the stored 
checksum through `stat` lets them compare it with their source digest for a 
specific object version without downloading the object.
   
   # What changes are included in this PR?
   
   `Operator.stat` and `AsyncOperator.stat` accept a `checksum` keyword 
argument that defaults to `False`. Both forward the hint alongside `version` to 
core. `StatKwargs` includes the optional boolean, and the Python metadata 
generator exposes a read-only `Metadata.checksum` property typed as 
`tuple[ChecksumAlgorithm, bytes] | None`.
   
   On a versioned AWS S3 object, both operators returned the older version’s 
CRC32C after a second write to the same key. Its four raw digest bytes matched 
both the independently computed source CRC32C and S3’s `HeadObject` checksum 
for that version ID. The newer version had a different CRC32C. This live check 
covers full-object CRC32C on AWS S3 with SSE-S3.
   
   # Are there any user-facing changes?
   
   Pass the version ID recorded at write time to compare the stored digest with 
the source CRC32C bytes.
   
   ```python
   stored = op.stat(key, version=version_id, checksum=True).checksum
   if stored is not None:
       assert stored == ("crc32c", source_crc32c_bytes)
   ```
   
   When the service supplies a full-object checksum, the property returns the 
existing Python algorithm name and raw digest bytes. A service can also supply 
a checksum by default. A successful `stat` returns `None` for the property when 
no full-object checksum is available. If `stat` fails, its usual exception 
propagates, including `NotFound` for a missing object.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Pi via T3 Code, `magpie/codex/gpt-6.2-sol`, `max` effort, implemented the 
change, verified the binding and independently reviewed the candidate.
   - Pi via T3 Code, `magpie/codex/gpt-6.2-astra`, `high` effort, coordinated 
the work and prepared the PR.
   


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