-
Notifications
You must be signed in to change notification settings - Fork 523
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
feat(bindings/C): implement capability #3479
Conversation
Can you share more details about this decision? Why not change now instead? |
For example, s3 doesn't support blocking API natively, but they can do this after adding I'm guessing it's ok for bindings just expose |
For example, now our error is backed by opendal_byte *b = error->message;
for (int i = 0; i < b->len; ++I)
printf("%s", b->data[i]);
opendal_byte_free(b) But in the CString way, we are only giving a char* msg = error->message:
printf(%s", msg);
free(msg); This will break the current way of handling error, but it is more conventional |
You have the authority to make such changes as the committer of OpenDAL and code owner of OpenDAL C binding. You're empowered to suggest API changes when necessary. The question I asked is about the timing: How about making those changes now before release, instead of after release? |
Project like milvus is using c binding right now. Are they manually linking the library or building from source? I am not really sure about this. My original thought is that they are building from source. If this is the case, changing the upstream code might break their code that is using stuff like error. But if they just use the static library and previous header and manually link to that, changing it now will be fine. Does that make sense to you? |
Your concern is correct. milvus is using OpenDAL via clone it directly: # git clone https://github.com/jiaoew1991/opendal.git opendal
git clone https://github.com/apache/incubator-opendal.git opendal
cd opendal
# git checkout blocking-layer
if command -v cargo >/dev/null 2>&1; then
echo "cargo exists"
else
bash -c "curl https://sh.rustup.rs -sSf | sh -s -- -y" || { echo 'rustup install failed'; exit 1;}
source $HOME/.cargo/env
fi
pushd bindings/c
cargo build || { echo 'opendal_c build failed'; exit 1; }
popd
mkdir -p ${ROOT_DIR}/internal/core/output/lib
mkdir -p ${ROOT_DIR}/internal/core/output/include
cp target/debug/libopendal_c.a ${ROOT_DIR}/internal/core/output/lib/libopendal_c.a
cp bindings/c/include/opendal.h ${ROOT_DIR}/internal/core/output/include/opendal.h It's by design to allow break on
I'm worried that we're still a long way from releasing our first version of opendal-c. We may need to implement more significant changes for opendal-c. We can't simply delay them all and wait for the next version. Conclusion:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM.
I agree with what @Xuanwo mentioned and prefer to make the string change before the release. (But I think we should do it in a separate PR, making it easier to review). As for the test framework thing, I am gonna look into that later as well. \cc @jiaoew1991, can you update the code in milvus to use the version by commit? Cuz we might break some APIs in the break. |
👍, Sure! |
I will choose a stable commit 😅 |
After implementing capability, the test framework for C is easier to implement. #3472
Two concerns along with this:
opendal_byte
backed string like error message to leaked CString, which is more conventional for C. (This is my mistake at the very beginning 😢). I think this break the current API, so my plan would be changing this after our first release.