feat(binding/go): Add Copier#7732
Open
FrankYang0529 wants to merge 1 commit into
Open
Conversation
dentiny
reviewed
Jun 25, 2026
erickguan
reviewed
Jul 3, 2026
erickguan
left a comment
Member
There was a problem hiding this comment.
Some comments on C binding firstly.
| if !ptr.is_null() { | ||
| drop(Box::from_raw((*ptr).inner as *mut core::blocking::Copier)); | ||
| drop(Box::from_raw(ptr)); | ||
| } |
Member
Author
There was a problem hiding this comment.
IIUC, setting (*ptr).inner = NULL wouldn't add protection. The ptr is passed by value we can't null out the caller's own pointer. Changing the signature to opendal_copier ** would allow that, but all existing *_free functions in this binding (operator/reader/writer/lister) follow the same by-value pattern, so I kept it consistent.
Member
There was a problem hiding this comment.
I agree with you that (*ptr).inner = NULL wouldn't add protection. My C pointer story told me that setting some nullptr really helps debugging when things goes south.
But this is beyond the PR. So I will only recommend this.
Signed-off-by: PoAn Yang <payang@apache.org>
4f9be09 to
2530233
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #7731
Rationale for this change
Rust core exposes
Operator::copier()(aCopierhandle that drives a long-running copy step by step), but it was missing from both the C and Go bindings, so Go users only had the one-shotOperator.Copy. This adds it.What changes are included in this PR?
opendal_operator_copier/opendal_operator_copier_with, plus anopendal_copierhandle withopendal_copier_next/_abort/_freeand matching result types.Copiertype withOperator.Copier(src, dest, ...),Next() (uint, bool, error),Abort()andClose(). Copy-option building is refactored into a shared helper reused by bothCopyandCopier.Are there any user-facing changes?
New
Operator.CopierAPI in the Go binding (and the underlyingopendal_operator_copier*C functions). No breaking changes.AI Usage Statement
Claude Code with Opus 4.8.