chitralverma commented on PR #9315: URL: https://github.com/apache/opendal/pull/9315#issuecomment-7234570785
*AI-generated comment (Claude Code), posted with @chitralverma's approval.* @Xuanwo, before this merges: would you rather drop the hardcoded order than freeze it? `FROZEN_CAPABILITY_ORDER` (98 names in `dev/src/generate/c.rs`) exists only because callers read `opendal_capability` by field position. It keeps positional initializers correct after a rebuild, but it does not keep the binary ABI stable. `opendal_operator_info_get_capability` writes the whole struct into caller storage ([`operator_info.rs#L121`](https://github.com/apache/opendal/blob/d8ea8bbb069a0e2dc563ad03f8304efa33e234b6/bindings/c/src/operator_info.rs#L121)), so an appended field can still grow it. On Linux x86-64, one more `bool` takes it from 152 to 160 bytes. Each future capability then needs a manual append and can still break existing binaries. Alternative: generate one function per capability, the way `opendal_metadata_*` accessors are already generated: ```c bool opendal_operator_info_capability_read(const opendal_operator_info *info); uintptr_t opendal_operator_info_capability_write_multi_max_size(const opendal_operator_info *info); ``` That removes the frozen list, the positional-initializer test, and the Go layout probe. A new capability becomes a new symbol, which does not break existing binaries. Go would bind these functions through purego instead of mirroring the layout, and Zig's `OperatorInfo.capability()` would wrap them. The next release already breaks this ABI (out-pointer getter, 104 → 152 bytes), so switching now costs users one break instead of two. If you prefer to keep the struct, the upgrade notes should say that each appended field can still break the binary ABI. -- 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]
