Skip to content

feat(binding/go): Add ListWithVersions and ListWithDeleted support #7632

@FrankYang0529

Description

@FrankYang0529

Feature Description

Add ListWithVersions and ListWithDeleted functional options to the Go binding's List operation, exposing the corresponding fields from the Rust ListOptions struct.

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

Are you willing to contribute to the development of this feature?

  • Yes, I am willing to contribute to the development of this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bindings/goenhancementNew feature or requestreleases-note/featThe PR implements a new feature or has a title that begins with "feat"

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions