-
Notifications
You must be signed in to change notification settings - Fork 148
Add sync API for transactional client #517
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
base: master
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @odecode! |
f90bd47 to
20f8737
Compare
There was a problem hiding this 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 PR adds a synchronous API wrapper for the TiKV transactional client to address issue #289. The implementation provides blocking alternatives to the existing async transaction APIs.
Changes:
- Introduced
SyncTransactionClient,SyncTransaction, andSyncSnapshotstructs that wrap their async counterparts - Each sync type contains an Arc-wrapped Tokio runtime and uses
block_onto execute async operations synchronously - Added comprehensive integration tests mirroring the async test patterns
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/transaction/sync_client.rs | New synchronous client wrapper providing blocking transaction operations |
| src/transaction/sync_transaction.rs | Synchronous transaction wrapper that blocks on async transaction methods |
| src/transaction/sync_snapshot.rs | Synchronous snapshot wrapper for read-only operations |
| src/transaction/mod.rs | Module declarations for new sync components |
| src/lib.rs | Public API exports for sync types |
| tests/sync_transaction_tests.rs | Comprehensive integration tests covering all sync APIs |
| tests/common/mod.rs | Added init_sync() helper for synchronous test setup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…th block_on. Signed-off-by: Otto Westerlund <westerlundotto@gmail.com>
Signed-off-by: Otto Westerlund <westerlundotto@gmail.com>
Signed-off-by: Otto Westerlund <westerlundotto@gmail.com>
Signed-off-by: Otto Westerlund <westerlundotto@gmail.com>
Signed-off-by: Otto Westerlund <westerlundotto@gmail.com>
Signed-off-by: Otto Westerlund <westerlundotto@gmail.com>
80170a7 to
2fad975
Compare
|
Thank you for the review comments, I have made changes according to the comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Otto Westerlund <westerlundotto@gmail.com>
Signed-off-by: Otto Westerlund <westerlundotto@gmail.com>
|
I have made changes requested by the review comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| pub fn init_sync() -> Result<()> { | ||
| tokio::runtime::Runtime::new()?.block_on(init()) |
Copilot
AI
Jan 18, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The init_sync function creates a temporary Tokio runtime just to initialize the test environment. This creates a nested runtime situation where init_sync creates a runtime to call init, then that runtime is dropped, and then each test creates its own runtime through sync_client. While this works, it's inefficient and could potentially lead to resource issues. Consider creating a single runtime that persists for the duration of testing, or restructuring init_sync to avoid the temporary runtime creation.
| tokio::runtime::Runtime::new()?.block_on(init()) | |
| if let Ok(handle) = tokio::runtime::Handle::try_current() { | |
| handle.block_on(init()) | |
| } else { | |
| tokio::runtime::Runtime::new()?.block_on(init()) | |
| } |
For issue #289 a synchronous API for transactional client.
I have programmed a fair bit but new to OSS and Rust. I consulted AI heavily for this to try and get an understanding of what this part of the project is about and how it works, but I tried using it a teacher rather than just "vibe coding".