Skip to content

Add c-api/Rust wrappers for SonicV2Connector#1080

Merged
qiluo-msft merged 9 commits into
sonic-net:masterfrom
qiluo-msft:qiluo/rustsonicv2
Sep 26, 2025
Merged

Add c-api/Rust wrappers for SonicV2Connector#1080
qiluo-msft merged 9 commits into
sonic-net:masterfrom
qiluo-msft:qiluo/rustsonicv2

Conversation

@qiluo-msft
Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft commented Sep 22, 2025

This PR adds c-api/Rust wrappers for SonicV2Connector and EventPublisher, so they will be available for Rust application development. Also add unit tests for c-api and Rust wrappers.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@qiluo-msft qiluo-msft marked this pull request as ready for review September 24, 2025 17:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds C-API and Rust wrappers for the SonicV2Connector functionality, providing a comprehensive interface to Redis database operations with namespace support.

  • Implements complete C-API bindings for SonicV2Connector operations including connection management, key-value operations, and pattern-based operations
  • Adds Rust wrapper with safe, ergonomic API and async support for all SonicV2Connector functionality
  • Provides comprehensive test coverage for both C-API and Rust implementations

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
common/c-api/sonicv2connector.h C header defining SonicV2Connector API interface
common/c-api/sonicv2connector.cpp C++ implementation of SonicV2Connector C-API bindings
crates/swss-common/src/types/sonicv2connector.rs Rust wrapper providing safe API over C bindings
tests/test_sonicv2connector_c_api.cpp Comprehensive C++ test suite for C-API
crates/swss-common/tests/test_sonicv2connector.rs Rust test suite mirroring Python functionality
crates/swss-common-testing/src/lib.rs Added TEST_DB configuration for testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread tests/test_sonicv2connector_c_api.cpp
Comment thread crates/swss-common-testing/src/lib.rs
@qiluo-msft qiluo-msft requested a review from liuh-80 September 24, 2025 17:13
Comment thread crates/swss-common/tests/test_sonicv2connector.rs Outdated
Comment thread crates/swss-common/tests/test_sonicv2connector.rs
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

@r12f r12f left a comment

Choose a reason for hiding this comment

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

lifecycle looks good to me! drops calls delete and internal resources covered by RAII.

@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to msft-202506: Azure/sonic-swss-common.msft#72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants