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

KVS API template for storing vector metadata #2597

Closed
wants to merge 0 commits into from

Conversation

smorihira
Copy link
Collaborator

@smorihira smorihira commented Sep 6, 2024

  • Implemented a template for the KVS API in Rust to store vector metadata

Description

  • Implemented meta.proto (get, set, delete) and part of payload.proto
  • Created a Rust template for the implementation of the traits generated by the proto (rust/bin/meta)

Related Issue

Versions

  • Vald Version: v1.7.13
  • Go Version: v1.23.0
  • Rust Version: v1.80.0
  • Docker Version: v27.1.1
  • Kubernetes Version: v1.30.3
  • Helm Version: v3.15.3
  • NGT Version: v2.2.4
  • Faiss Version: v1.8.0

Checklist

Special notes for your reviewer

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a Meta component with methods for managing metadata (Get, Set, Delete).
    • Added comprehensive API documentation for the Meta component, enhancing clarity for developers.
    • Implemented a gRPC service for the Meta component, facilitating efficient metadata management.
  • Bug Fixes

    • Improved error handling in the metadata service, ensuring more informative responses.
  • Documentation

    • Expanded API documentation to include detailed descriptions of new metadata structures and operations.
  • Chores

    • Updated project dependencies to enhance compatibility and performance.

@CLAassistant
Copy link

CLAassistant commented Sep 6, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ hlts2
✅ kpango
❌ smorihira
You have signed the CLA already but the status is still pending? Let us recheck it.

@smorihira smorihira changed the title feature/meta/same-metadata [WIP]feature/meta/same-metadata Sep 6, 2024
deepsource-autofix bot added a commit that referenced this pull request Sep 6, 2024
This commit fixes the style issues introduced in 801cb31 according to the output
from Gofumpt and Prettier.

Details: #2597
Copy link

cloudflare-workers-and-pages bot commented Sep 6, 2024

Deploying vald with  Cloudflare Pages  Cloudflare Pages

Latest commit: f8d373f
Status: ✅  Deploy successful!
Preview URL: https://437b4373.vald.pages.dev
Branch Preview URL: https://feature-meta-save-metadata.vald.pages.dev

View logs

Copy link
Contributor

coderabbitai bot commented Sep 6, 2024

Walkthrough

Walkthrough

The changes introduce a new Meta component to the API, enhancing metadata management through the addition of new structures, methods, and a gRPC service. Key features include operations for getting, setting, and deleting metadata, along with updated documentation and a new Rust package for the meta functionality. The modifications streamline existing server implementations by removing unnecessary abstractions and improving response handling. Additionally, several files are auto-generated as part of the protocol buffer compilation process, ensuring structured data handling across the codebase.

Changes

Files Change Summary
apis/docs/v1/docs.md, apis/proto/v1/meta/meta.proto, apis/proto/v1/payload/payload.proto, apis/swagger/v1/meta/meta.swagger.json Added Meta structures and methods for metadata management, including detailed documentation and RPC methods.
rust/Cargo.toml, rust/bin/meta/Cargo.toml, rust/bin/meta/src/main.rs, rust/bin/meta/src/handler.rs, rust/bin/meta/src/handler/meta.rs Introduced a new Rust package for meta, including server setup and handler implementations for metadata operations.
rust/libs/proto/Cargo.toml, rust/libs/proto/src/core.v1.rs, rust/libs/proto/src/core.v1.tonic.rs, rust/libs/proto/src/discoverer.v1.rs, rust/libs/proto/src/discoverer.v1.tonic.rs, rust/libs/proto/src/filter.egress.v1.rs, rust/libs/proto/src/filter.egress.v1.tonic.rs, rust/libs/proto/src/filter.ingress.v1.rs, rust/libs/proto/src/filter.ingress.v1.tonic.rs, rust/libs/proto/src/lib.rs, rust/libs/proto/src/meta.v1.rs, rust/libs/proto/src/meta.v1.tonic.rs, rust/libs/proto/src/mirror.v1.rs, rust/libs/proto/src/mirror.v1.tonic.rs, rust/libs/proto/src/payload.v1.rs, rust/libs/proto/src/rpc.v1.rs, rust/libs/proto/src/sidecar.v1.rs, rust/libs/proto/src/sidecar.v1.tonic.rs, rust/libs/proto/src/vald.v1.rs, rust/libs/proto/src/vald.v1.tonic.rs Various files auto-generated, with modifications to server implementations, removal of unnecessary structs, and updates to derive attributes for efficiency.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant MetaService
    Client->>MetaService: Get(Key)
    MetaService->>MetaStore: Retrieve Value
    MetaStore-->>MetaService: Return Value
    MetaService-->>Client: Return Value
Loading
sequenceDiagram
    participant Client
    participant MetaService
    Client->>MetaService: Set(KeyValue)
    MetaService->>MetaStore: Store KeyValue
    MetaStore-->>MetaService: Acknowledge
    MetaService-->>Client: Acknowledge
Loading
sequenceDiagram
    participant Client
    participant MetaService
    Client->>MetaService: Delete(Key)
    MetaService->>MetaStore: Remove Key
    MetaStore-->>MetaService: Acknowledge
    MetaService-->>Client: Acknowledge
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

rust/bin/meta/src/handler.rs Outdated Show resolved Hide resolved
@smorihira smorihira marked this pull request as ready for review September 9, 2024 05:16
@smorihira smorihira changed the title [WIP]feature/meta/same-metadata feature/meta/same-metadata Sep 9, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 12

Outside diff range, codebase verification and nitpick comments (1)
rust/libs/proto/src/payload.v1.rs (1)

1216-1241: Approved: Addition of Meta struct and nested types.

The introduction of the Meta struct along with its nested types Key, Value, and KeyValue enhances the protocol buffer definitions by facilitating the handling of key-value pairs. However, it's recommended to add comprehensive documentation for these new types to ensure clarity and ease of use.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b17cc73 and 77d1a2a.

Files ignored due to path filters (39)
  • apis/grpc/v1/agent/core/agent.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/agent/core/agent_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/agent/sidecar/sidecar.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/agent/sidecar/sidecar_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/discoverer/discoverer.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/discoverer/discoverer_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/filter/egress/egress_filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/filter/egress/egress_filter_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/filter/ingress/ingress_filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/filter/ingress/ingress_filter_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/meta/meta.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/meta/meta_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/mirror/mirror.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/mirror/mirror_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/payload/payload.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/payload/payload.pb.json.go is excluded by !**/*.pb.json.go
  • apis/grpc/v1/payload/payload_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/rpc/errdetails/error_details.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/rpc/errdetails/error_details.pb.json.go is excluded by !**/*.pb.json.go
  • apis/grpc/v1/rpc/errdetails/error_details_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/filter_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/flush.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/flush_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/index.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/index_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/insert.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/insert_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/object.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/object_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/remove.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/remove_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/search.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/search_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/update.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/update_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/upsert.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/upsert_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • rust/Cargo.lock is excluded by !**/*.lock
Files selected for processing (46)
  • apis/docs/v1/docs.md (4 hunks)
  • apis/proto/v1/meta/meta.proto (1 hunks)
  • apis/proto/v1/payload/payload.proto (2 hunks)
  • apis/swagger/v1/agent/core/agent.swagger.json (4 hunks)
  • apis/swagger/v1/agent/sidecar/sidecar.swagger.json (1 hunks)
  • apis/swagger/v1/discoverer/discoverer.swagger.json (4 hunks)
  • apis/swagger/v1/filter/egress/egress_filter.swagger.json (3 hunks)
  • apis/swagger/v1/filter/ingress/ingress_filter.swagger.json (3 hunks)
  • apis/swagger/v1/meta/meta.swagger.json (1 hunks)
  • apis/swagger/v1/mirror/mirror.swagger.json (2 hunks)
  • apis/swagger/v1/payload/payload.swagger.json (1 hunks)
  • apis/swagger/v1/rpc/errdetails/error_details.swagger.json (1 hunks)
  • apis/swagger/v1/vald/filter.swagger.json (9 hunks)
  • apis/swagger/v1/vald/flush.swagger.json (2 hunks)
  • apis/swagger/v1/vald/index.swagger.json (6 hunks)
  • apis/swagger/v1/vald/insert.swagger.json (3 hunks)
  • apis/swagger/v1/vald/object.swagger.json (5 hunks)
  • apis/swagger/v1/vald/remove.swagger.json (5 hunks)
  • apis/swagger/v1/vald/search.swagger.json (9 hunks)
  • apis/swagger/v1/vald/update.swagger.json (3 hunks)
  • apis/swagger/v1/vald/upsert.swagger.json (3 hunks)
  • rust/Cargo.toml (1 hunks)
  • rust/bin/meta/Cargo.toml (1 hunks)
  • rust/bin/meta/src/handler.rs (1 hunks)
  • rust/bin/meta/src/handler/meta.rs (1 hunks)
  • rust/bin/meta/src/main.rs (1 hunks)
  • rust/libs/proto/Cargo.toml (1 hunks)
  • rust/libs/proto/src/core.v1.rs (1 hunks)
  • rust/libs/proto/src/core.v1.tonic.rs (8 hunks)
  • rust/libs/proto/src/discoverer.v1.rs (1 hunks)
  • rust/libs/proto/src/discoverer.v1.tonic.rs (8 hunks)
  • rust/libs/proto/src/filter.egress.v1.rs (1 hunks)
  • rust/libs/proto/src/filter.egress.v1.tonic.rs (7 hunks)
  • rust/libs/proto/src/filter.ingress.v1.rs (1 hunks)
  • rust/libs/proto/src/filter.ingress.v1.tonic.rs (7 hunks)
  • rust/libs/proto/src/lib.rs (1 hunks)
  • rust/libs/proto/src/meta.v1.rs (1 hunks)
  • rust/libs/proto/src/meta.v1.tonic.rs (1 hunks)
  • rust/libs/proto/src/mirror.v1.rs (1 hunks)
  • rust/libs/proto/src/mirror.v1.tonic.rs (6 hunks)
  • rust/libs/proto/src/payload.v1.rs (18 hunks)
  • rust/libs/proto/src/rpc.v1.rs (2 hunks)
  • rust/libs/proto/src/sidecar.v1.rs (1 hunks)
  • rust/libs/proto/src/sidecar.v1.tonic.rs (4 hunks)
  • rust/libs/proto/src/vald.v1.rs (1 hunks)
  • rust/libs/proto/src/vald.v1.tonic.rs (85 hunks)
Files skipped from review due to trivial changes (28)
  • apis/swagger/v1/agent/core/agent.swagger.json
  • apis/swagger/v1/agent/sidecar/sidecar.swagger.json
  • apis/swagger/v1/discoverer/discoverer.swagger.json
  • apis/swagger/v1/filter/egress/egress_filter.swagger.json
  • apis/swagger/v1/filter/ingress/ingress_filter.swagger.json
  • apis/swagger/v1/mirror/mirror.swagger.json
  • apis/swagger/v1/payload/payload.swagger.json
  • apis/swagger/v1/rpc/errdetails/error_details.swagger.json
  • apis/swagger/v1/vald/filter.swagger.json
  • apis/swagger/v1/vald/flush.swagger.json
  • apis/swagger/v1/vald/index.swagger.json
  • apis/swagger/v1/vald/insert.swagger.json
  • apis/swagger/v1/vald/object.swagger.json
  • apis/swagger/v1/vald/remove.swagger.json
  • apis/swagger/v1/vald/search.swagger.json
  • apis/swagger/v1/vald/update.swagger.json
  • apis/swagger/v1/vald/upsert.swagger.json
  • rust/bin/meta/Cargo.toml
  • rust/bin/meta/src/handler.rs
  • rust/libs/proto/src/core.v1.rs
  • rust/libs/proto/src/discoverer.v1.rs
  • rust/libs/proto/src/filter.egress.v1.rs
  • rust/libs/proto/src/filter.ingress.v1.rs
  • rust/libs/proto/src/lib.rs
  • rust/libs/proto/src/meta.v1.rs
  • rust/libs/proto/src/mirror.v1.rs
  • rust/libs/proto/src/sidecar.v1.rs
  • rust/libs/proto/src/vald.v1.rs
Additional context used
buf
apis/proto/v1/meta/meta.proto

21-21: import "google/api/annotations.proto": file does not exist

(COMPILE)

checkov
apis/swagger/v1/meta/meta.swagger.json

[HIGH] 1-177: Ensure that security requirement defined in securityDefinitions - version 2.0 files

(CKV_OPENAPI_6)


[HIGH] 1-177: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)


[HIGH] 1-177: Ensure that security operations is not empty.

(CKV_OPENAPI_5)


[HIGH] 1-177: Ensure that securityDefinitions is defined and not empty - version 2.0 files

(CKV_OPENAPI_1)

Markdownlint
apis/docs/v1/docs.md

687-687: null
Link fragments should be valid

(MD051, link-fragments)

Additional comments not posted (54)
rust/Cargo.toml (1)

20-24: Verify workspace changes for potential impacts.

The addition of "bin/meta" is aligned with the PR's objectives and is approved. However, the commenting out of "bin/agent", "libs/algorithm", "libs/algorithms/ngt", and "libs/algorithms/faiss" could potentially impact other parts of the project.

Please ensure that these changes do not affect the build process or dependency management adversely. Consider providing a rationale for these changes in the PR description to help reviewers understand the context.

rust/libs/proto/Cargo.toml (1)

26-26: Approve addition of prost-types, verify compatibility.

The addition of prost-types version 0.13.2 is approved as it likely enhances the project's serialization capabilities. Ensure compatibility with existing prost version 0.13.1.

Please confirm that prost-types version 0.13.2 is fully compatible with the existing prost version 0.13.1 used in the project.

rust/bin/meta/src/main.rs (1)

19-30: Approve main function implementation, consider detailed error handling.

The implementation of the main function in main.rs is correct and follows best practices for setting up an asynchronous server in Rust. The use of tonic for gRPC services is appropriate.

Consider adding more detailed error handling or logging to improve observability and maintainability of the server application.

apis/proto/v1/meta/meta.proto (1)

30-45: Well-defined gRPC service.

The protobuf definitions for the Meta service are well-structured and correctly annotated for RESTful access. This setup allows for both gRPC and HTTP/REST access to the metadata management functions.

rust/libs/proto/src/sidecar.v1.tonic.rs (2)

98-98: Structural improvements in SidecarServer.

The changes to use Arc<T> directly in the SidecarServer structure enhance clarity and reduce unnecessary complexity. This is a positive change that aligns with the PR objectives of simplifying the server implementations.


177-181: Improved HTTP response header handling.

The dynamic setting of the "grpc-status" and "content-type" headers improves the flexibility and correctness of the server's response handling. This change is a good practice and enhances the server's adaptability to different scenarios.

apis/swagger/v1/meta/meta.swagger.json (3)

1-177: Well-structured API documentation.

The Swagger file is well-organized, providing clear definitions for operations and their parameters. The use of JSON as the content type for both consuming and producing is appropriate for web APIs.

Tools
checkov

[HIGH] 1-177: Ensure that security requirement defined in securityDefinitions - version 2.0 files

(CKV_OPENAPI_6)


[HIGH] 1-177: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)


[HIGH] 1-177: Ensure that security operations is not empty.

(CKV_OPENAPI_5)


[HIGH] 1-177: Ensure that securityDefinitions is defined and not empty - version 2.0 files

(CKV_OPENAPI_1)


1-177: Good practice: Default error handling.

The inclusion of a default error response for unexpected errors is a good practice, ensuring that the API gracefully handles any unspecified errors that might occur.

Tools
checkov

[HIGH] 1-177: Ensure that security requirement defined in securityDefinitions - version 2.0 files

(CKV_OPENAPI_6)


[HIGH] 1-177: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)


[HIGH] 1-177: Ensure that security operations is not empty.

(CKV_OPENAPI_5)


[HIGH] 1-177: Ensure that securityDefinitions is defined and not empty - version 2.0 files

(CKV_OPENAPI_1)


1-177: Effective use of JSON references.

The extensive use of JSON references ($ref) to avoid redundancy and maintain DRY principles in API documentation is commendable.

Tools
checkov

[HIGH] 1-177: Ensure that security requirement defined in securityDefinitions - version 2.0 files

(CKV_OPENAPI_6)


[HIGH] 1-177: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)


[HIGH] 1-177: Ensure that security operations is not empty.

(CKV_OPENAPI_5)


[HIGH] 1-177: Ensure that securityDefinitions is defined and not empty - version 2.0 files

(CKV_OPENAPI_1)

rust/libs/proto/src/mirror.v1.tonic.rs (2)

132-132: Structural simplification approved.

The removal of the _Inner struct and the direct use of Arc<T> in the MirrorServer struct simplifies the structure and reduces unnecessary complexity, enhancing both readability and maintainability.


259-263: Method adjustments and response header updates are well-implemented.

The adjustments to the call method, which now directly clones the Arc<T>, and the use of constants for response headers from the tonic library, streamline the process and improve maintainability.

rust/libs/proto/src/rpc.v1.rs (2)

70-70: Enhancement to RetryInfo struct approved.

The addition of the Copy trait to the RetryInfo struct, allowing instances to be copied in addition to being cloned, is a beneficial change that can improve performance and usability in certain scenarios.


3-26: Updated comments for error handling are beneficial.

The detailed examples of error responses enhance the documentation and provide developers with better context for understanding the potential errors when interacting with APIs.

rust/libs/proto/src/filter.ingress.v1.tonic.rs (2)

179-179: Simplified structure by using Arc<T> directly.

The change to directly use Arc<T> in the FilterServer struct simplifies the internal structure and reduces complexity. This should enhance both readability and performance.

Ensure that this change integrates seamlessly with the rest of the system and that all functionalities relying on the FilterServer are still operating as expected.


354-358: Improved maintainability by using constants for response headers.

Replacing hardcoded header values with constants from the tonic library enhances maintainability and ensures consistency. This is a good practice that helps avoid errors and makes the code easier to update.

rust/libs/proto/src/filter.egress.v1.tonic.rs (2)

179-179: Simplified structure by using Arc<T> directly.

The change to directly use Arc<T> in the FilterServer struct simplifies the internal structure and reduces complexity. This should enhance both readability and performance.

Ensure that this change integrates seamlessly with the rest of the system and that all functionalities relying on the FilterServer are still operating as expected.


354-358: Improved maintainability by using constants for response headers.

Replacing hardcoded header values with constants from the tonic library enhances maintainability and ensures consistency. This is a good practice that helps avoid errors and makes the code easier to update.

rust/libs/proto/src/core.v1.tonic.rs (2)

207-207: Simplified structure by using Arc<T> directly.

The change to directly use Arc<T> in the AgentServer struct simplifies the internal structure and reduces complexity. This should enhance both readability and performance.

Ensure that this change integrates seamlessly with the rest of the system and that all functionalities relying on the AgentServer are still operating as expected.


430-434: Improved maintainability by using constants for response headers.

Replacing hardcoded header values with constants from the tonic library enhances maintainability and ensures consistency. This is a good practice that helps avoid errors and makes the code easier to update.

rust/libs/proto/src/discoverer.v1.tonic.rs (4)

215-215: Approved structural change to DiscovererServer.

The change from _Inner<T> to Arc<T> simplifies the structure and potentially improves performance by reducing unnecessary abstraction.


215-215: Approved method update in DiscovererServer.

The update to the new method to directly use Arc::new(inner) simplifies object creation and aligns with the structural changes.


215-215: Approved method update in DiscovererServer.

The update to the from_arc method to directly assign the Arc<T> to the inner field simplifies the method and is consistent with the structural changes.


438-442: Approved updates to HTTP response headers.

The use of tonic::Code::Unimplemented as i32 for the "grpc-status" header and tonic::metadata::GRPC_CONTENT_TYPE for the content type header improves maintainability and aligns with tonic framework conventions.

rust/libs/proto/src/payload.v1.rs (15)

5-5: Verify Copy trait compatibility for nested types in Search.

The addition of the Copy trait to the Search struct enhances performance by allowing instances to be duplicated by simple assignment. However, it's crucial to ensure that all nested types within Search also support the Copy trait to avoid compilation errors or unexpected behavior.


186-186: Verify Copy trait compatibility for nested types in Filter.

Ensure that all nested types within the Filter struct support the Copy trait to maintain consistency and avoid potential issues during compilation or runtime.


213-213: Verify Copy trait compatibility for nested types in Insert.

As with other structs, ensure that all nested types within the Insert struct are compatible with the Copy trait to ensure smooth functionality and performance benefits.


276-276: Verify Copy trait compatibility for nested types in Update.

Confirm that all nested types within the Update struct support the Copy trait, ensuring that the struct can be efficiently duplicated and used without issues.


343-343: Verify Copy trait compatibility for nested types in Upsert.

Ensure that all nested types within the Upsert struct are compatible with the Copy trait to maintain performance and functionality.


410-410: Verify Copy trait compatibility for nested types in Remove.

Check that all nested types within the Remove struct support the Copy trait, ensuring that the struct can be efficiently duplicated and used in various contexts.


445-445: Verify Copy trait compatibility for nested types in Timestamp.

As with other structs, ensure that all nested types within the Timestamp struct are compatible with the Copy trait to avoid potential issues during use.


5-5: Verify Copy trait compatibility for nested types in Config.

Ensure that all nested types within the Config struct support the Copy trait, maintaining consistency and functionality across the struct and its uses.


518-518: Verify Copy trait compatibility for nested types in Flush.

Confirm that all nested types within the Flush struct support the Copy trait, ensuring efficient duplication and use in various scenarios.


530-530: Verify Copy trait compatibility for nested types in Object.

As with other structs, ensure that all nested types within the Object struct are compatible with the Copy trait to maintain performance and functionality.


736-736: Verify Copy trait compatibility for nested types in List.

Check that all nested types within the List struct support the Copy trait, ensuring that the struct can be efficiently duplicated and used in various contexts.


768-768: Verify Copy trait compatibility for nested types in Control.

Ensure that all nested types within the Control struct support the Copy trait, maintaining performance and functionality across the struct and its uses.


784-784: Verify Copy trait compatibility for nested types in Discoverer.

Confirm that all nested types within the Discoverer struct support the Copy trait, ensuring that the struct can be efficiently duplicated and used without issues.


806-806: Verify Copy trait compatibility for nested types in Info.

Ensure that all nested types within the Info struct support the Copy trait, maintaining consistency and functionality across the struct and its uses.


1244-1244: Approved: Changes to Empty struct.

The addition of the Copy trait to the Empty struct is straightforward and beneficial, as it likely does not contain any fields or nested types that would conflict with the Copy trait.

apis/docs/v1/docs.md (2)

53-56: Documentation for Meta Component Added

The addition of the Meta, Meta.Key, Meta.KeyValue, and Meta.Value sections to the Table of Contents is well-executed. This update helps users navigate the new functionalities related to metadata handling more efficiently.


122-123: New Section for Meta Protobuf Definitions

The inclusion of v1/meta/meta.proto in the Table of Contents is crucial for developers to quickly access the protobuf definitions related to the Meta component. This addition enhances the documentation's structure and accessibility.

rust/libs/proto/src/vald.v1.tonic.rs (9)

623-623: Refactoring and improvements in FilterServer are beneficial.

The transition to using Arc<T> directly in FilterServer simplifies the internal structure and potentially improves performance by removing unnecessary indirection. The use of constants for HTTP response codes and content types in the call method enhances readability and maintainability.

Also applies to: 1290-1294


1447-1447: Consistent improvements in FlushServer.

The updates to FlushServer follow the same pattern as FilterServer, using Arc<T> directly and employing constants for HTTP response handling. This consistency is good for code maintainability and readability.

Also applies to: 1574-1578


1876-1876: Good application of refactoring in IndexServer.

The IndexServer also benefits from the refactoring to use Arc<T> directly, along with the use of constants for HTTP response handling. These changes enhance the code's consistency and maintainability.

Also applies to: 2195-2199


2445-2445: Refactoring in InsertServer maintains consistency and clarity.

Like the other server implementations, InsertServer has been updated to use Arc<T> directly and constants for HTTP response codes and content types. This consistency across the board is commendable.

Also applies to: 2671-2675


3007-3007: Effective refactoring in ObjectServer.

ObjectServer follows the established pattern of using Arc<T> directly and employing constants for HTTP response handling, which improves the code's maintainability and readability.

Also applies to: 3330-3334


3620-3620: Consistent refactoring in RemoveServer.

RemoveServer benefits from the same refactoring pattern as the other servers, using Arc<T> directly and constants for HTTP response handling. This consistency is good for code maintainability.

Also applies to: 3894-3898


4536-4536: Good refactoring practices in SearchServer.

SearchServer also incorporates the refactoring to use Arc<T> directly and constants for HTTP response handling, enhancing the code's consistency and maintainability.

Also applies to: 5205-5209


5455-5455: Refactoring in UpdateServer maintains consistency and clarity.

Like the other server implementations, UpdateServer has been updated to use Arc<T> directly and constants for HTTP response codes and content types. This consistency across the board is commendable.

Also applies to: 5681-5685


5931-5931: Effective refactoring in UpsertServer.

UpsertServer follows the established pattern of using Arc<T> directly and employing constants for HTTP response handling, which improves the code's maintainability and readability.

Also applies to: 6157-6161

rust/libs/proto/src/meta.v1.tonic.rs (3)

61-70: Clarify the usage of compression settings.

The methods send_compressed and accept_compressed are marked with #[must_use], which is good practice. However, ensure that the server-side also supports these compression settings to avoid runtime errors.

Verification successful

Server-side compression settings are supported.

The server-side code includes mechanisms to handle compression settings, as indicated by the presence of EnabledCompressionEncodings and methods to enable specific encodings. This confirms that the server-side supports the compression settings used in the client-side methods send_compressed and accept_compressed. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify server-side support for compression settings.

# Test: Search for server-side compression handling. Expect: Confirm server-side settings.
rg --type rust "compression"

Length of output: 47386


37-55: Evaluate the necessity of custom interceptors.

The method with_interceptor allows for custom interceptors to be added to the client. Ensure that this functionality is necessary for the project's requirements and that it does not introduce security or performance issues.


264-426: Ensure proper routing and error handling in server calls.

The call method in MetaServer handles routing for different gRPC methods. Ensure that all paths are correctly handled and that there are appropriate error responses for unsupported or incorrect paths.

Verification successful

Proper Routing and Error Handling Verified

The call method in rust/libs/proto/src/meta.v1.tonic.rs correctly handles the expected gRPC paths (/meta.v1.Meta/Get, /meta.v1.Meta/Set, /meta.v1.Meta/Delete) and includes a default case for unsupported paths, returning a grpc-status of Unimplemented. This ensures proper routing and error handling in server calls. No issues were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify correct routing and error handling for gRPC methods.

# Test: Search for gRPC method implementations. Expect: Confirm all paths are handled.
rg --type rust "MetaServer::call"

Length of output: 33


Script:

#!/bin/bash
# Use ast-grep to search for the call method implementation in the context of gRPC server handling.
ast-grep --lang rust --pattern 'impl $_ for $_ { fn call(&mut self, $_) -> $_ { $$$ } }'

Length of output: 90


Script:

#!/bin/bash
# Use rg to search for the fn call definition across the Rust codebase.
rg --type rust "fn call"

Length of output: 6134

apis/proto/v1/payload/payload.proto (2)

22-22: Ensure necessary imports for new message types.

The import of google/protobuf/any.proto is essential for the Value message type to utilize the Any type. This is a good practice as it ensures that the protobuf definitions are self-contained and can utilize advanced features provided by the protobuf library.


770-783: Review the new Meta message structure for consistency and completeness.

The new Meta message structure, including Key, Value, and KeyValue, is well-defined. Ensure that these definitions are consistent with the project's data handling requirements and that they integrate seamlessly with existing systems.

rust/bin/meta/src/handler/meta.rs Outdated Show resolved Hide resolved
rust/bin/meta/src/handler/meta.rs Outdated Show resolved Hide resolved
rust/bin/meta/src/handler/meta.rs Outdated Show resolved Hide resolved
apis/proto/v1/meta/meta.proto Outdated Show resolved Hide resolved
apis/swagger/v1/meta/meta.swagger.json Outdated Show resolved Hide resolved
rust/libs/proto/src/meta.v1.tonic.rs Outdated Show resolved Hide resolved
rust/libs/proto/src/meta.v1.tonic.rs Outdated Show resolved Hide resolved
rust/libs/proto/src/meta.v1.tonic.rs Outdated Show resolved Hide resolved
rust/libs/proto/src/meta.v1.tonic.rs Outdated Show resolved Hide resolved
rust/libs/proto/src/meta.v1.tonic.rs Outdated Show resolved Hide resolved
@hlts2 hlts2 self-requested a review September 9, 2024 05:53
dockers/dev/Dockerfile Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 77d1a2a and ce0184f.

Files ignored due to path filters (6)
  • apis/grpc/v1/meta/meta.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/meta/meta_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/payload/payload.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/payload/payload.pb.json.go is excluded by !**/*.pb.json.go
  • apis/grpc/v1/payload/payload_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/rpc/errdetails/error_details.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
Files selected for processing (37)
  • apis/swagger/v1/meta/meta.swagger.json (1 hunks)
  • dockers/agent/core/agent/Dockerfile (2 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (1 hunks)
  • dockers/dev/Dockerfile (2 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
  • rust/bin/meta/Cargo.toml (1 hunks)
  • rust/bin/meta/src/handler/meta.rs (1 hunks)
  • rust/bin/meta/src/main.rs (1 hunks)
  • rust/libs/proto/src/core.v1.tonic.rs (7 hunks)
  • rust/libs/proto/src/discoverer.v1.tonic.rs (7 hunks)
  • rust/libs/proto/src/filter.egress.v1.tonic.rs (6 hunks)
  • rust/libs/proto/src/filter.ingress.v1.tonic.rs (6 hunks)
  • rust/libs/proto/src/meta.v1.tonic.rs (1 hunks)
  • rust/libs/proto/src/mirror.v1.tonic.rs (5 hunks)
  • rust/libs/proto/src/payload.v1.rs (18 hunks)
  • rust/libs/proto/src/rpc.v1.rs (1 hunks)
  • rust/libs/proto/src/sidecar.v1.tonic.rs (3 hunks)
  • rust/libs/proto/src/vald.v1.tonic.rs (84 hunks)
Files skipped from review due to trivial changes (24)
  • dockers/agent/core/agent/Dockerfile
  • dockers/agent/core/faiss/Dockerfile
  • dockers/agent/core/ngt/Dockerfile
  • dockers/agent/sidecar/Dockerfile
  • dockers/binfmt/Dockerfile
  • dockers/buildbase/Dockerfile
  • dockers/buildkit/Dockerfile
  • dockers/ci/base/Dockerfile
  • dockers/dev/Dockerfile
  • dockers/discoverer/k8s/Dockerfile
  • dockers/gateway/filter/Dockerfile
  • dockers/gateway/lb/Dockerfile
  • dockers/gateway/mirror/Dockerfile
  • dockers/index/job/correction/Dockerfile
  • dockers/index/job/creation/Dockerfile
  • dockers/index/job/readreplica/rotate/Dockerfile
  • dockers/index/job/save/Dockerfile
  • dockers/index/operator/Dockerfile
  • dockers/manager/index/Dockerfile
  • dockers/operator/helm/Dockerfile
  • dockers/tools/benchmark/job/Dockerfile
  • dockers/tools/benchmark/operator/Dockerfile
  • dockers/tools/cli/loadtest/Dockerfile
  • rust/bin/meta/Cargo.toml
Files skipped from review as they are similar to previous changes (7)
  • rust/bin/meta/src/handler/meta.rs
  • rust/bin/meta/src/main.rs
  • rust/libs/proto/src/core.v1.tonic.rs
  • rust/libs/proto/src/meta.v1.tonic.rs
  • rust/libs/proto/src/payload.v1.rs
  • rust/libs/proto/src/rpc.v1.rs
  • rust/libs/proto/src/vald.v1.tonic.rs
Additional context used
checkov
apis/swagger/v1/meta/meta.swagger.json

[HIGH] 1-167: Ensure that security requirement defined in securityDefinitions - version 2.0 files

(CKV_OPENAPI_6)


[HIGH] 1-167: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)


[HIGH] 1-167: Ensure that security operations is not empty.

(CKV_OPENAPI_5)


[HIGH] 1-167: Ensure that securityDefinitions is defined and not empty - version 2.0 files

(CKV_OPENAPI_1)

Additional comments not posted (14)
rust/libs/proto/src/sidecar.v1.tonic.rs (3)

111-111: Structural simplification approved.

The change to use Arc<T> directly in the SidecarServer struct simplifies the code and reduces unnecessary complexity.


111-111: Method updates approved.

The updates to the new and from_arc methods align well with the structural changes to the SidecarServer struct, enhancing clarity and maintainability.


190-194: Improved response header handling approved.

The use of dynamic values from the tonic library for the "grpc-status" and "content-type" headers enhances flexibility and maintainability.

rust/libs/proto/src/mirror.v1.tonic.rs (2)

145-145: Structural simplification approved.

The change to use Arc<T> directly in the MirrorServer struct simplifies the code and reduces unnecessary complexity.


272-276: Improved response header handling approved.

The use of dynamic values from the tonic library for the "grpc-status" and "content-type" headers enhances flexibility and maintainability.

rust/libs/proto/src/filter.ingress.v1.tonic.rs (3)

367-371: Use of constants for HTTP headers in call method enhances maintainability.

Replacing hardcoded header values with constants from the tonic library in the call method is a best practice that improves code maintainability and reduces error likelihood.


192-192: Simplification of FilterServer structure approved.

The direct use of Arc<T> in the FilterServer struct simplifies the code and aligns with common Rust practices for handling shared ownership in concurrent environments.

Verification successful

All references to _Inner have been successfully updated.

The transition to using Arc<T> directly in the FilterServer struct is complete, with no remaining references to _Inner found in the codebase. This confirms the successful simplification of the code structure.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify that all references to the old `_Inner` struct have been updated.
rg --type rust "_Inner" "rust/libs/proto/src/"

Length of output: 44


Script:

#!/bin/bash
# Verify that all references to the old `_Inner` struct have been updated across the entire repository.
rg --type rust "_Inner"

Length of output: 23


192-192: Updated factory methods in FilterServer are correct.

The changes to the new and from_arc methods to directly use Arc<T> are appropriate and simplify the server instantiation process.

Verification successful

Changes to new and from_arc methods are verified and correct.

The direct use of Arc<T> in the new and from_arc methods of FilterServer in filter.ingress.v1.tonic.rs is consistent with the refactoring pattern across the codebase and does not introduce any unexpected side effects. The instantiation process is simplified without impacting functionality.

  • The methods are used appropriately in creating FilterClient instances with InterceptedService.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any unexpected side effects in the usage of the updated `new` and `from_arc` methods.
rg --type rust "new\(|from_arc\(" "rust/libs/proto/src/"

Length of output: 32334

rust/libs/proto/src/filter.egress.v1.tonic.rs (3)

367-371: Use of constants for HTTP headers in call method for egress enhances maintainability.

Replacing hardcoded header values with constants from the tonic library in the call method is a best practice that improves code maintainability and reduces error likelihood.


192-192: Simplification of FilterServer structure in egress file approved.

The direct use of Arc<T> in the FilterServer struct simplifies the code and aligns with common Rust practices for handling shared ownership in concurrent environments.

Verification successful

Verification successful: No remaining references to _Inner found.

The transition to using Arc<T> directly in the FilterServer struct appears to be complete, with no outdated references to _Inner in the rust/libs/proto/src/ directory. This change simplifies the code and aligns with Rust's best practices for shared ownership.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify that all references to the old `_Inner` struct have been updated in the egress context.
rg --type rust "_Inner" "rust/libs/proto/src/"

Length of output: 44


192-192: Updated factory methods in FilterServer for egress are correct.

The changes to the new and from_arc methods to directly use Arc<T> are appropriate and simplify the server instantiation process.

Verification successful

Verification successful: No issues found with the updated new and from_arc methods in FilterServer for egress.

The changes to use Arc<T> directly in these methods are consistent with the intended design and do not introduce any unexpected side effects. The implementation aligns with similar changes in the ingress context.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any unexpected side effects in the usage of the updated `new` and `from_arc` methods in the egress context.
rg --type rust "new\(|from_arc\(" "rust/libs/proto/src/"

Length of output: 32334

rust/libs/proto/src/discoverer.v1.tonic.rs (3)

451-455: Use of constants for HTTP headers in call method of DiscovererServer enhances maintainability.

Replacing hardcoded header values with constants from the tonic library in the call method is a best practice that improves code maintainability and reduces error likelihood.


228-228: Updated factory methods in DiscovererServer are correct.

The changes to the new and from_arc methods to directly use Arc<T> are appropriate and simplify the server instantiation process.

Verification successful

No unexpected side effects found in DiscovererServer methods.

The changes to the new and from_arc methods in the DiscovererServer class, which now directly use Arc<T>, do not introduce any unexpected side effects. The updates are consistent with similar changes in other parts of the codebase and simplify the server instantiation process.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any unexpected side effects in the usage of the updated `new` and `from_arc` methods in the discoverer context.
rg --type rust "new\(|from_arc\(" "rust/libs/proto/src/"

Length of output: 32334


228-228: Simplification of DiscovererServer structure approved.

The direct use of Arc<T> in the DiscovererServer struct simplifies the code and aligns with common Rust practices for handling shared ownership in concurrent environments.

Verification successful

All references to _Inner have been successfully removed or updated.

The codebase no longer contains any references to _Inner, confirming that the transition to using Arc<T> directly in the DiscovererServer struct has been fully implemented. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify that all references to the old `_Inner` struct have been updated in the discoverer context.
rg --type rust "_Inner" "rust/libs/proto/src/"

Length of output: 44


Script:

#!/bin/bash
# Perform a broader search across the entire codebase for any references to `_Inner`.
rg --type rust "_Inner"

Length of output: 23

@smorihira smorihira changed the title feature/meta/same-metadata feature/meta/save-metadata Sep 9, 2024
@smorihira smorihira changed the title feature/meta/save-metadata KVS API template for storing vector metadata Sep 9, 2024
rust/Cargo.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ce0184f and 4b6a7f6.

Files selected for processing (1)
  • rust/Cargo.toml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • rust/Cargo.toml

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 9, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4b6a7f6 and 312410f.

Files ignored due to path filters (7)
  • apis/grpc/v1/meta/meta.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/meta/meta_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/payload/payload.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/payload/payload.pb.json.go is excluded by !**/*.pb.json.go
  • apis/grpc/v1/payload/payload_vtproto.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/rpc/errdetails/error_details.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • rust/Cargo.lock is excluded by !**/*.lock
Files selected for processing (19)
  • apis/docs/v1/docs.md (4 hunks)
  • apis/swagger/v1/meta/meta.swagger.json (1 hunks)
  • rust/Cargo.toml (1 hunks)
  • rust/bin/meta/Cargo.toml (1 hunks)
  • rust/bin/meta/src/handler.rs (1 hunks)
  • rust/bin/meta/src/handler/meta.rs (1 hunks)
  • rust/bin/meta/src/main.rs (1 hunks)
  • rust/libs/proto/Cargo.toml (1 hunks)
  • rust/libs/proto/src/core.v1.tonic.rs (7 hunks)
  • rust/libs/proto/src/discoverer.v1.tonic.rs (7 hunks)
  • rust/libs/proto/src/filter.egress.v1.tonic.rs (6 hunks)
  • rust/libs/proto/src/filter.ingress.v1.tonic.rs (6 hunks)
  • rust/libs/proto/src/lib.rs (1 hunks)
  • rust/libs/proto/src/meta.v1.tonic.rs (1 hunks)
  • rust/libs/proto/src/mirror.v1.tonic.rs (5 hunks)
  • rust/libs/proto/src/payload.v1.rs (18 hunks)
  • rust/libs/proto/src/rpc.v1.rs (1 hunks)
  • rust/libs/proto/src/sidecar.v1.tonic.rs (3 hunks)
  • rust/libs/proto/src/vald.v1.tonic.rs (84 hunks)
Files not reviewed due to server errors (3)
  • rust/libs/proto/src/core.v1.tonic.rs
  • rust/libs/proto/src/discoverer.v1.tonic.rs
  • rust/libs/proto/src/payload.v1.rs
Files skipped from review due to trivial changes (3)
  • rust/bin/meta/Cargo.toml
  • rust/bin/meta/src/main.rs
  • rust/libs/proto/src/lib.rs
Files skipped from review as they are similar to previous changes (6)
  • rust/bin/meta/src/handler.rs
  • rust/bin/meta/src/handler/meta.rs
  • rust/libs/proto/Cargo.toml
  • rust/libs/proto/src/meta.v1.tonic.rs
  • rust/libs/proto/src/rpc.v1.rs
  • rust/libs/proto/src/vald.v1.tonic.rs
Additional context used
checkov
apis/swagger/v1/meta/meta.swagger.json

[HIGH] 1-167: Ensure that security requirement defined in securityDefinitions - version 2.0 files

(CKV_OPENAPI_6)


[HIGH] 1-167: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)


[HIGH] 1-167: Ensure that security operations is not empty.

(CKV_OPENAPI_5)


[HIGH] 1-167: Ensure that securityDefinitions is defined and not empty - version 2.0 files

(CKV_OPENAPI_1)

Markdownlint
apis/docs/v1/docs.md

687-687: null
Link fragments should be valid

(MD051, link-fragments)

Additional comments not posted (9)
rust/libs/proto/src/sidecar.v1.tonic.rs (3)

111-111: Simplification of SidecarServer struct.

The changes to the SidecarServer struct, specifically the direct use of Arc<T> for the inner field and the removal of the _Inner struct, enhance the code's readability and maintainability by reducing indirection.


Line range hint 123-131:


190-194: Improved HTTP response handling.

The modifications to the HTTP response handling in the call method, specifically the use of dynamic values for the "grpc-status" and "content-type" headers, enhance the flexibility and correctness of the server's response handling.

rust/libs/proto/src/mirror.v1.tonic.rs (1)

145-145: LGTM! The changes simplify the MirrorServer implementation and improve code clarity.

The key improvements include:

  • Removing the unnecessary _Inner struct and directly using Arc<T> in the MirrorServer struct.
  • Updating the new and from_arc methods to align with the struct changes.
  • Simplifying the handling of the inner variable in the call method.
  • Using constants from the tonic library for response headers, enhancing maintainability.

These changes reduce complexity, improve readability, and maintain the existing functionality of the MirrorServer.

Also applies to: 192-276

rust/libs/proto/src/filter.ingress.v1.tonic.rs (1)

192-192: LGTM! The changes simplify the FilterServer implementation and improve code clarity.

The key improvements include:

  • Removing the unnecessary _Inner struct and directly using Arc<T> in the FilterServer struct.
  • Updating the new and from_arc methods to align with the struct changes.
  • Simplifying the handling of the inner variable in the call method.
  • Using constants from the tonic library for response headers, enhancing maintainability.

These changes reduce complexity, improve readability, and maintain the existing functionality of the FilterServer.

Also applies to: 367-371

rust/libs/proto/src/filter.egress.v1.tonic.rs (1)

192-192: LGTM! The changes simplify the FilterServer implementation and improve code clarity.

The key improvements include:

  • Removing the unnecessary _Inner struct and directly using Arc<T> in the FilterServer struct.
  • Updating the from_arc method to remove wrapping of inner in _Inner.
  • Simplifying the handling of the inner variable in the call method.
  • Using constants from the tonic library for response headers, enhancing maintainability.

These changes reduce complexity, improve readability, and maintain the existing functionality of the FilterServer.

Also applies to: 367-371

apis/docs/v1/docs.md (3)

660-688: Documentation for Meta Component Looks Good!

The detailed documentation for the Meta component, including the Meta, Meta.Key, Meta.KeyValue, and Meta.Value structures, is comprehensive and well-structured. Each field is clearly described, which will be beneficial for developers integrating or utilizing the metadata functionalities.

Tools
Markdownlint

687-687: null
Link fragments should be valid

(MD051, link-fragments)


1333-1348: Documentation for v1/meta/meta.proto Looks Good!

The documentation for the v1/meta/meta.proto file and the Meta service is clear and concise. The Get, Set, and Delete methods are appropriately documented with their request and response types.


687-687: Skipping Markdownlint Hint

The link fragment #google-protobuf-Any appears to be valid and consistent with other link fragments used in the documentation. It likely refers to the google.protobuf.Any message type, which is a commonly used type in protocol buffers.

The static analysis hint seems to be a false positive in this case, as the link fragment follows the established convention and does not exhibit any apparent issues.

Tools
Markdownlint

687-687: null
Link fragments should be valid

(MD051, link-fragments)

apis/swagger/v1/meta/meta.swagger.json Outdated Show resolved Hide resolved
Copy link
Contributor

@hlts2 hlts2 left a comment

Choose a reason for hiding this comment

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

LGTM!

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 10, 2024
Copy link
Collaborator

@kpango kpango left a comment

Choose a reason for hiding this comment

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

LGTM

@kpango
Copy link
Collaborator

kpango commented Sep 12, 2024

@all-contributors please add @smorihira for design

@kpango kpango closed this Sep 12, 2024
@kpango kpango deleted the feature/meta/save-metadata branch September 12, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment