Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change NewNative funcs to accept unsafe.Pointer #87

Merged
merged 2 commits into from
Sep 25, 2022

Conversation

muthukrishnan24
Copy link
Contributor

This PR changes NewNative functions to accept unsafe.Pointer instead of C pointers

@linxGnu
Copy link
Owner

linxGnu commented Sep 14, 2022

Hello @muthukrishnan24
IMHO, it's better to hide/make NewNative* private rather than change the API. We don't want user to make wrong with C pointer/unsafe.Pointer.
How do you think?

@muthukrishnan24
Copy link
Contributor Author

I agree not all structs need NewNative* exported. But some can be useful like SetNativeComparator

@linxGnu
Copy link
Owner

linxGnu commented Sep 15, 2022

@muthukrishnan24 yeah I agree with you. So lets update the PR: only expose NewNative for needed struct, hide others.

@muthukrishnan24
Copy link
Contributor Author

Hi @linxGnu, updated the PR, exported NewNative for only needed structs

cache.go Outdated Show resolved Hide resolved
Copy link
Owner

@linxGnu linxGnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your great effort. Almost LGTM. Could you please address below comments

iterator.go Outdated Show resolved Hide resolved
@@ -78,8 +79,8 @@ type MultiMerger interface {
}

// NewNativeMergeOperator creates a MergeOperator object.
func NewNativeMergeOperator(c *C.rocksdb_mergeoperator_t) MergeOperator {
return &nativeMergeOperator{c}
func NewNativeMergeOperator(c unsafe.Pointer) MergeOperator {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are exporting NewNative funcs for SliceTransform, CompactionFilter, MergeOperator

slice_transform.go Show resolved Hide resolved
compaction_filter.go Show resolved Hide resolved
Copy link
Owner

@linxGnu linxGnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Great job. Thank you so much for this contribution

@linxGnu linxGnu merged commit 448e0c9 into linxGnu:master Sep 25, 2022
@muthukrishnan24 muthukrishnan24 deleted the native_create branch September 25, 2022 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants