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

[ENH] Add rust protobufs and conversion. Add build.rs, protobufs, and conversions #1513

Merged
merged 5 commits into from
Jan 16, 2024

Conversation

HammadB
Copy link
Collaborator

@HammadB HammadB commented Dec 13, 2023

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • Update dockerfile to use a fetched protoc since that is needed for protoc to include/ WKT
  • New functionality
    • Adds a build.rs so that we can build the protos into rust bindings
    • Adds a types/ folder with types and rust-y/idiomatic TryFrom conversions so that callers can just do .try_from() and get type inference.
    • Adds a macro for error type wrapping and impl'ing ChromaError on the macro.
    • All types are rexported from types/ so that the rest of the code can easily use it.

Test plan

How are these changes tested?

  • Add very rudimentary tests for conversion. We should do a pass where we add some more rigorous conversion testing.
  • Tests pass locally with cargo test

Documentation Changes

None required.

Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readbility, Modularity, Intuitiveness)

@@ -84,6 +84,9 @@ impl RootConfig {
/// ## Description of parameters
/// - my_ip: The IP address of the worker service. Used for memberlist assignment. Must be provided
/// - num_indexing_threads: The number of indexing threads to use. If not provided, defaults to the number of cores on the machine.
/// - pulsar_tenant: The pulsar tenant to use. Must be provided.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

clean up

mod types;

mod chroma_proto {
tonic::include_proto!("chroma");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This links the built proto

#[error("Invalid UUID")]
InvalidUuid,
#[error(transparent)]
MetadataValueConversionError(#[from] MetadataValueConversionError),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Example of wrapping an error

@HammadB HammadB requested a review from beggers December 13, 2023 04:47
@HammadB HammadB force-pushed the hammad/rust_assignment_policy branch from 51cf2ad to c12425e Compare December 13, 2023 07:24
@HammadB HammadB force-pushed the hammad/rust_types_proto branch from d7327b3 to 1dd5d74 Compare December 13, 2023 10:55
@HammadB HammadB force-pushed the hammad/rust_types_proto branch from 1dd5d74 to 9c7dfab Compare December 13, 2023 11:03
@HammadB HammadB changed the base branch from hammad/rust_assignment_policy to main December 13, 2023 11:03
Copy link
Contributor

@beggers beggers left a comment

Choose a reason for hiding this comment

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

Looks good! Just a couple questions

rust/worker/src/types/collection.rs Show resolved Hide resolved
rust/worker/src/types/metadata.rs Show resolved Hide resolved
rust/worker/src/types/segment.rs Show resolved Hide resolved
rust/worker/src/types/operation.rs Outdated Show resolved Hide resolved
@HammadB HammadB force-pushed the hammad/rust_types_proto branch from 0de2a33 to 1823c17 Compare January 15, 2024 23:53
@HammadB HammadB merged commit af37c9a into main Jan 16, 2024
98 checks passed
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