Skip to content

Go/Core Refactor: Move FFI to a Dedicated Folder for Reusability - #3372

Merged
barshaul merged 4 commits into
mainfrom
ffi_ipc
Mar 24, 2025
Merged

barshaul merged 4 commits into
mainfrom
ffi_ipc

Conversation

@barshaul

@barshaul barshaul commented Mar 16, 2025

Copy link
Copy Markdown
Collaborator

This PR relocates the FFI interface from the Go folder to a dedicated ffi folder, making it reusable for other language wrappers.

Currently, the FFI C-Rust implementation is located under the Go folder since it has only been used for Go. However, as we expand support for additional wrappers, such as the C# and Python Sync clients, which will communicate via FFI instead of UDS, we need to move the logic out of the Go folder to improve reusability and maintainability.

Issue link

This Pull Request is linked to issue (URL): #3373

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated.
  • CHANGELOG.md and documentation files are updated.
  • Destination branch is correct - main or release
  • Create merge commit if merging release branch into main, squash otherwise.

@barshaul
barshaul force-pushed the ffi_ipc branch 2 times, most recently from 7c71bda to 45daae4 Compare March 16, 2025 16:05
@barshaul barshaul changed the title Go/Core Refactore: Move FFI to a dedicated folder to be reusable for other wrappers Go/Core Refactor: Move FFI to a Dedicated Folder for Reusability Mar 16, 2025
@barshaul
barshaul marked this pull request as ready for review March 17, 2025 12:44
@barshaul
barshaul requested a review from a team as a code owner March 17, 2025 12:44
Comment thread ffi/.gitignore
Comment thread ffi/src/lib.rs

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This lib actively uses protobuf, while C# client - doesn't.
So I see two variants there

  1. We will be having 2 FFI interfaces
  2. Rework golang bindings to avoid using protobuf

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Need to clean up some code comments which refer to golang

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

  1. If 2 isn't possible, put protobuf functions under a feature flag. Please do it in the C# implementation.

Comment thread .github/workflows/ffi.yml Outdated
working-directory: ffi
run: |
cargo build --release
- name: Generate the C header file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It is needed for go client only and does not test the code

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

it isn't go-specific, it can be used in other FFI wrappers as well (C++ for example)

Comment thread .github/workflows/ffi.yml Outdated
Comment thread ffi/Cargo.toml
Comment thread ffi/cbindgen.toml
Comment thread go/Makefile Outdated
Comment thread go/Makefile Outdated
Comment thread go/Makefile Outdated
Comment thread go/Makefile Outdated
Signed-off-by: barshaul <barshaul@amazon.com>
Signed-off-by: barshaul <barshaul@amazon.com>
Comment thread ffi/README.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread ffi/tests/ffi_client_tests.rs Outdated
Comment thread ffi/tests/ffi_client_tests.rs Outdated
Comment thread ffi/tests/ffi_client_tests.rs Outdated
Comment thread ffi/tests/ffi_client_tests.rs
Comment thread ffi/tests/ffi_client_tests.rs
Comment thread ffi/tests/ffi_client_tests.rs Outdated
Signed-off-by: barshaul <barshaul@amazon.com>
@jamesx-improving

Copy link
Copy Markdown
Collaborator

Sorry I missed reviewing this PR. Only comment I have is: I made the decision to compile to staticlib (.a file) for Golang compatibility. I see rlib is also added in the new ffi/Cargo.toml file. Please keep monitoring compatibility issue for other languages as it is now shared by multiple.

liorsve pushed a commit to liorsve/valkey-glide that referenced this pull request Mar 30, 2025
…key-io#3372)

* Go/Core Refactore: Move FFI to a dedicated folder to be reusable for other wrappers

Signed-off-by: barshaul <barshaul@amazon.com>
affonsov pushed a commit that referenced this pull request Aug 21, 2026
* Go/Core Refactore: Move FFI to a dedicated folder to be reusable for other wrappers

Signed-off-by: barshaul <barshaul@amazon.com>
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.

4 participants