new feature: generate C and Go operation options from core

Open
#9,323 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
c, go, rust, zig

Research direction

Start with dev/src/generate/c.rs, the handwritten option definitions in bindings/c/src/types.rs, and the Go option functions under bindings/go. Trace generated output through bindings/c/build.rs and the frozen-surface tests. Done means the intended C and Go options are generated and exposed as specified, with ABI and release-impact notes updated.

Written by the indexing model from the issue text.

Description

bindings/c bindings/go bindings/zig core enhancement

Drafted with AI assistance; the author is accountable for it.

Feature Description

Generate the C option structs and the Go options that fill them from core (one generate -l c run; Zig re-exports the header), then expose what both lack. Part of #9320, whose rules apply to every PR here.

Progress

One item per options struct, covering C and Go. A struct is done when its options are generated from core and every core field is exposed. New fields change struct layout, so they wait for one batched C/C++ layout break.

  • ListOptions
    • Generated from core (#9335)
    • glob
  • StatOptions
    • Generated from core (#9350)
    • Version conditions
  • ReadOptions
    • Generated from core (#9379)
    • limit and version conditions
  • ReaderOptions
    • Generated from core (#9385)
    • Version conditions
  • WriteOptions
    • Generated from core (#9389)
    • Borrowed string rules for write entry points (#9409)
    • content_language, expires, version conditions, if_not_changed
  • DeleteOptions
    • Generated from core (#9368)
    • Conditions
  • CopyOptions
    • Generated from core (#9402)
    • Conditions and destination metadata
  • RenameOptions: needs a C entry point
  • RestoreOptions, DeleterOptions, ComposeOptions: need entry points (core blocking compose: #9423)
  • checksum (#9316)
Problem and Solution

Reference PRs: #9335 and #9350 (RELEASED_OPTIONS in dev/src/generate/c/options.rs). Regenerate with cargo run --manifest-path=dev/Cargo.toml -- generate -l c, then build the C binding so cbindgen refreshes opendal.h.

C and Go invariants

  • opendal.h is ABI: member order, types, sizeof, offsets, and setter signatures stay as on main.
  • Each field keeps its unset encoding, pointer constness, and string ownership, and the docs state them.
  • Docs write ErrorKind::X as the opendal_code and Go ErrorCode from bindings/c/src/error.rs.
  • Conversions reading caller pointers are pub(crate) unsafe fn with # Safety, called under // SAFETY:, never safe From.
  • Generating existing options adds no #[no_mangle] symbol: Go resolves all C symbols at load, so new ones need rebuilt opendal-go-services and a bindings/go/upgrade.md note.
  • New fields change sizeof: declare it in bindings/c/upgrade.md and release_impact.py format for C and Go.

Design questions for new fields: entry points for rename and the deleter, compose and restore functions, suffix ranges, and a copied const opendal_metadata * for if_not_changed.

Additional Context

Generating existing options is not release-impacting. New fields change the C ABI layout and the Go companion requirements.

Are you willing to contribute to the development of this feature?
  • Yes, I am willing to contribute to the development of this feature.
Dominant language
Rust
Stars
5.5k
Forks
869
Avg merge
8h 2m
Merged PRs (30d)
862

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/opendal

All issues in apache/opendal

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.