chitralverma opened a new pull request, #9389:
URL: https://github.com/apache/opendal/pull/9389
# Which issue does this PR close?
Part of #9323 (tracker #9320).
# Rationale for this change
Generates the existing C and Go `WriteOptions` from core, as #9335, #9350,
#9368, #9379, and #9385 did for the other option structs. It exposes no new
option.
# What changes are included in this PR?
- The C/Go options generator gets a `WriteOptions` table with `main`'s 13 C
members in order. `user_metadata` gets a new encoding: a borrowed
`opendal_write_user_metadata_pair` array and its length.
- C: the conversion is an `unsafe fn to_core` with a `# Safety` contract
instead of a safe `From` that read raw pointers. The skipped core `checksum`
keeps its default.
- Go: `WithWriteFn` and the 11 `WriteWith*` options move to `options.go`
with the same signatures and C call order.
- C/Go wording where core names Rust-only items:
- `opendal_operator_writer_with()` and `Operator.Writer` do not access
storage, so a condition fails a write or close. The `if_not_changed` sentence
is dropped.
- `opendal_operator_write_with()` and `Operator.Write` without `chunk`
pass one buffer to the service writer.
- User metadata comes back from a later stat, not `Reader::metadata`.
- C states the pair rules: a pair with a NULL key or value is skipped, and
a later pair replaces an earlier one with the same key.
- Go doc lists cannot nest, so Go lists core's nested items at the top
level, as gofmt does. C keeps them nested.
- New tests: frozen C layout and prototypes, the conversion, Go signatures
and exports, memory writes, and docs computed from core.
Verified: header declarations match `main` with comments removed (only the
`_free` prototype moves); exported symbols and `go doc -short` unchanged; a C
probe built with `main`'s header and `main`'s Go tests give identical results
on both libraries; 13 scratch mutations each fail a new test; doc claims traced
on memory, fs, and Silo S3; C (ASan, valgrind) and Go CI steps pass in an
Ubuntu 24.04 container.
Not verified: `fs` with `direct_io` from C or Go; Go behavior tests with
`opendal-go-services`; Windows.
# Are there any user-facing changes?
Doc comments only. A C write option string that is not valid UTF-8 still
panics; the message now names the field.
# Breaking changes
None.
# AI Usage Statement
- **Harness:** Claude Code via T3 Code | **Model:** Claude Opus 5.5 |
**Effort:** xhigh
- **Role:** Implemented the generator entry, docs, and tests; ran the checks
above; drafted this description. 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]