FrankYang0529 opened a new issue, #7633:
URL: https://github.com/apache/opendal/issues/7633

   ## Feature Description
   
   Add `ListWithLimit` and `ListWithStartAfter` functional options to the Go 
binding's `List` operation, exposing the pagination fields from the Rust 
`ListOptions` struct.
   
   ```go
   // Limit results per request
   lister, err := op.List("path/", opendal.ListWithLimit(100))
   
   // Start listing from a specific key
   lister, err := op.List("path/", opendal.ListWithStartAfter("last-seen-key"))
   
   // Combined
   lister, err := op.List("path/", opendal.ListWithLimit(100), 
opendal.ListWithStartAfter("last-seen-key"))
   ```
   
   ## 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 pagination fields:
   
   - `limit: Option<usize>` — hint to the backend for maximum results per 
request
   - `start_after: Option<String>` — start listing from the specified key 
(exclusive)
   
   The implementation requires slightly more care than the boolean options:
   1. Add `opendal_list_options_set_limit` and 
`opendal_list_options_set_start_after` to the C binding 
(`bindings/c/src/types.rs`) and regenerate `opendal.h`
   2. For `limit`: the C setter takes a `size_t`; the Go FFI wrapper uses 
`ffi.TypePointer` (uintptr-sized)
   3. For `start_after`: the C setter takes a nullable `*const c_char`; the Go 
FFI wrapper must pass a C string pointer, or NULL when not set
   4. Add `ListWithLimit(uint) WithListFn` and `ListWithStartAfter(string) 
WithListFn` in `lister.go`
   5. Add behavior tests where the backend supports pagination
   
   ## Additional Context
   
   - Rust reference: 
https://opendal.incubator.apache.org/docs/rust/opendal/options/struct.ListOptions.html
   - `limit` is a hint only; backends may return more or fewer results.
   - `start_after` semantics follow S3 conventions (exclusive lower bound).
   - Part of a series to fully expose `ListOptions` in the Go binding. See 
also: `versions` and `deleted` fields (#7632).


-- 
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]

Reply via email to