FrankYang0529 opened a new issue, #7632:
URL: https://github.com/apache/opendal/issues/7632
## Feature Description
Add `ListWithVersions` and `ListWithDeleted` functional options to the Go
binding's `List` operation, exposing the corresponding fields from the Rust
`ListOptions` struct.
```go
// List all versions of objects under a prefix
lister, err := op.List("path/", opendal.ListWithVersions(true))
// List including delete markers
lister, err := op.List("path/", opendal.ListWithDeleted(true))
```
## Problem and Solution
The Go binding currently only exposes `ListWithRecursive` (added in #7605).
The Rust core's
[`ListOptions`](https://opendal.incubator.apache.org/docs/rust/opendal/options/struct.ListOptions.html)
has two more boolean fields that are useful for version-aware backends (e.g.
S3 versioning):
- `versions: bool` — include all object versions in the listing
- `deleted: bool` — include delete markers in the listing
The implementation follows the same pattern as `ListWithRecursive`:
1. Add `ListWithVersions(bool) WithListFn` and `ListWithDeleted(bool)
WithListFn` in `lister.go`
2. Add `opendal_list_options_set_versions` and
`opendal_list_options_set_deleted` to the C binding (`bindings/c/src/types.rs`)
and regenerate `opendal.h`
3. Add corresponding FFI wrappers (`ffiListOptionsSetVersions`,
`ffiListOptionsSetDeleted`) in Go
4. Add behavior tests gated on `cap.ListWithVersions()` /
`cap.ListWithDeleted()`
## Additional Context
- Rust reference:
https://opendal.incubator.apache.org/docs/rust/opendal/options/struct.ListOptions.html
- Both fields are only meaningful on version-aware backends; the C and Go
layers should pass them through regardless and let the backend decide.
- Part of a series to fully expose `ListOptions` in the Go binding. See
also: `limit` and `start_after` fields.
--
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]