new feature: generate C++ operation options from core

Open
#9,324 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
28/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp, rust

Research direction

Start with dev/src/generate/cpp.rs, then trace the option mirrors and conversions in bindings/cpp/src/lib.rs and bindings/cpp/src/operator.cpp against bindings/cpp/include/data_structure.hpp. Implement the step-one generator and frozen-surface test before adding public options, reverse metadata conversion, new Operator methods, and release-impact documentation. The work is done when generated and handwritten surfaces agree, missing options and methods are exposed as specified, formatting and C++ CI diff checks pass, and bindings/cpp/upgrade.md declares the layout change.

Written by the indexing model from the issue text.

Description

bindings/cpp enhancement

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

Feature Description

Generate the C++ binding's operation options from core, then expose the options C++ lacks. Part of #9320, whose rules apply to every PR here.

Progress

One item per options struct. 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 (#9331)
    • glob
  • StatOptions
    • Generated from core (#9361)
    • Version conditions
  • ReadOptions
    • Generated from core (#9378)
    • limit and version conditions
  • ReaderOptions
    • Generated from core (#9382)
    • Version conditions
  • WriteOptions
    • Generated from core (#9387)
    • content_language, expires, version conditions, if_not_changed
  • DeleteOptions
    • Generated from core (#9366)
    • Conditions
  • CopyOptions
    • Generated from core (#9399)
    • Conditions and destination metadata
  • RenameOptions (#9401)
  • RestoreOptions, DeleterOptions, ComposeOptions: need Operator methods (core blocking compose: #9423)
  • checksum (#9316)
Problem and Solution

Reference PRs: #9331 and #9361. The OPTIONS table in dev/src/generate/cpp.rs renders each option's public struct, cxx mirror, and both converters. Regenerate with cargo run --manifest-path=dev/Cargo.toml -- generate -l cpp.

C++ invariants

  • Member order is append-only, since callers brace-initialize; member types and default initializers stay unchanged.
  • The released @brief stays, followed by core's doc. Docs write opendal::Capability::x and bare X for ErrorKind::X.
  • Output matches clang-format 18 (Google); run CI's Linux GCC/ASan, valgrind, and clang-18 async steps.
  • Compose, restore, and deleter types stay out of public headers until their entry points exist.
  • New fields change layout: declare a rebuild in bindings/cpp/upgrade.md and release_impact.py format for C++.

Design questions for new fields: options for the async API, Operator methods for compose, restore, and the deleter, and an opendal::Metadata input for if_not_changed.

Additional Context

Generating existing options is not release-impacting. New fields are source-compatible but change struct layout.

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.