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

Separate connection info from protobuf. #1088

Merged
merged 3 commits into from
Mar 19, 2024

Conversation

nihohit
Copy link
Contributor

@nihohit nihohit commented Mar 7, 2024

This will allow the FFI clients to remove their dependency on protobuf.

Pros:

  • faster compile times
  • no need for protobuf dependency in FFI wrappers.

Cons:

  • code duplication in model.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@nihohit nihohit requested a review from a team as a code owner March 7, 2024 10:13
@nihohit nihohit force-pushed the no-socket branch 3 times, most recently from 23af104 to 078d31e Compare March 7, 2024 12:29
@acarbonetto acarbonetto added the Rust core redis-rs/glide-core matter label Mar 7, 2024
signal-hook = "^0.3"
signal-hook-tokio = {version = "^0.3", features = ["futures-v0_3"] }
signal-hook = { version = "^0.3", optional = true }
signal-hook-tokio = {version = "^0.3", features = ["futures-v0_3"], optional = true }
Copy link
Collaborator

Choose a reason for hiding this comment

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

signal-hook-tokio prevented me to build glide on Windows. Now it is optional and I can go thru. redis-rs compilation fails though.
We are getting closer to Windows support. Just FYI.

once_cell = "1.18.0"
arcstr = "1.1.5"
sha1_smol = "1.0.0"

[features]
socket-layer = ["directories", "integer-encoding", "num_cpus", "signal-hook", "signal-hook-tokio"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it is worth adding description for the features somewhere. What about DEVELOPER.md?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't protobuf be under socket-layer too?

let read_from = request.read_from.enum_value().unwrap_or(ReadFrom::Primary);
let read_from_replicas = !matches!(read_from, ReadFrom::Primary,); // TODO - implement different read from replica strategies.
let read_from = request.read_from.unwrap_or_default();
let read_from_replicas = !matches!(read_from, ReadFrom::Primary); // TODO - implement different read from replica strategies.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, create a GH task for this TODO

Copy link
Contributor

Choose a reason for hiding this comment

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

please, check the GH issues. They've been there for months.

Copy link
Collaborator

Choose a reason for hiding this comment

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

glide-core/src/client/mod.rs Show resolved Hide resolved
glide-core/src/client/standalone_client.rs Show resolved Hide resolved
*/

#[derive(Default)]
pub struct ConnectionRequest {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is very similar to what I did in https://github.com/Bit-Quill/glide-for-redis/pull/126/files#diff-16c3ad2d12e1e72e855619ea6d9e15e29fab999c7545fbb03b0d8a9f995b96ab, but not FFI-ready.
Is there a way to update your implementation, so I'll reuse it instead of duplicating code? repr(C) and * c_char, etc.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Applicable fot all structs and enums there

Copy link
Contributor

Choose a reason for hiding this comment

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

unless you have a very good reason for it, you shouldn't use * c_char in your Rust structs, only in function signatures. instantiate them to Rust strings ASAP instead of passing unsafe pointers through the system.

Copy link
Contributor

Choose a reason for hiding this comment

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

let's decide if we want this, get this in, and then make the adjustments to make if fully FFI-compatible. I don't want to overload this PR with multiple changes.

glide-core/src/client/types.rs Show resolved Hide resolved
glide-core/src/client/types.rs Outdated Show resolved Hide resolved
@shachlanAmazon
Copy link
Contributor

@barshaul thoughts about this? keep or close?

nihohit and others added 3 commits March 19, 2024 16:07
This will allow the FFI clients to remove their dependency on protobuf.
Pros:
* faster compile times
* no need for protobuf dependency in wrappers.
@shachlanAmazon shachlanAmazon merged commit 5b3dc72 into valkey-io:main Mar 19, 2024
43 of 46 checks passed
@nihohit nihohit deleted the no-socket branch March 19, 2024 17:32
@shachlanAmazon
Copy link
Contributor

@aaron-congo @Yury-Fridlyand @SanHalacogluImproving @jonathanl-bq
please rebase the FFI branch on this - I hope this will make it easier to interface with GLIDE now.

cyip10 pushed a commit to Bit-Quill/valkey-glide that referenced this pull request Jun 24, 2024
* Separate connection info from protobuf.

This will allow the FFI clients to remove their dependency on protobuf.
Pros:
* faster compile times
* no need for protobuf dependency in wrappers.

* Update glide-core/src/client/types.rs

Co-authored-by: Aaron <[email protected]>

* round

---------

Co-authored-by: Shachar Langbeheim <[email protected]>
Co-authored-by: Aaron <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust core redis-rs/glide-core matter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants