new feature: generate C and Go operation options from core

Aperta
#9,323 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c, go, rust, zig

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Rust
Stelle
5.5k
Fork
869
Merge medio
8h 2m
PR unite (30g)
862

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/opendal

Tutte le issue di apache/opendal

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.