Skip to content

feat(binding/go): add deleter - #7999

Open
ryankert01 wants to merge 1 commit into
apache:mainfrom
ryankert01:feat/go-deleter
Open

feat(binding/go): add deleter#7999
ryankert01 wants to merge 1 commit into
apache:mainfrom
ryankert01:feat/go-deleter

Conversation

@ryankert01

@ryankert01 ryankert01 commented Jul 31, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

N/A

Rationale for this change

Core exposes Operator::deleter(), which queues paths and uses the service's batch deletion. Neither binding exposed it, so Go users deleted one path per request.

What changes are included in this PR?

// Delete a known set of paths.
err := op.Remove([]string{"a.txt", "b.txt", "c.txt"})

// Or drive a Deleter to queue paths as you discover them.
deleter, err := op.Deleter()
for _, path := range paths {
    err = deleter.Delete(path) // queues only
}
err = deleter.Close() // flushes the queue, waits, reports the outcome
  • C: opendal_operator_deleter returns an opendal_deleter handle, driven by opendal_deleter_delete, _delete_with, _close and _free.
  • C: opendal_delete_options gains a From impl for options::DeleteOptions, now shared with opendal_operator_delete_with.
  • Go: Operator.Deleter returns a Deleter with Delete(path, opts...) and Close. Delete queues a path; Close flushes the queue and reports the outcome. Operator.Remove(paths) wraps it.
  • Behavior tests, FFI ownership tests, and a "Delete many paths" docs section.

Are there any user-facing changes?

New Operator.Deleter and Operator.Remove in the Go binding, plus the opendal_operator_deleter and opendal_deleter_* C functions. No breaking changes; docs updated.

AI Usage Statement

Claude Code with Opus 5. (I understand the code that I told claude to write)

@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. releases-note/feat The PR implements a new feature or has a title that begins with "feat" labels Jul 31, 2026
@ryankert01

Copy link
Copy Markdown
Member Author

cc @dentiny

Add a Deleter to the Go binding so callers can remove many paths through
the batch deletion support of the service, mirroring `Operator::deleter`
in the core.

C binding:

- `opendal_operator_deleter` returns an `opendal_deleter` wrapping
  `blocking::Deleter`.
- `opendal_deleter_delete`, `opendal_deleter_delete_with`,
  `opendal_deleter_close` and `opendal_deleter_free` drive and release it.
- `opendal_delete_options` gains a `From` impl for `options::DeleteOptions`,
  which `opendal_operator_delete_with` now uses as well.

Go binding:

- `Operator.Deleter` returns a `Deleter` with `Delete(path, opts...)` and
  `Close`. `Delete` queues a path; `Close` flushes the queue, waits for the
  deletions and reports their outcome.
- `Operator.Remove(paths)` drives a deleter for the caller.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant