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

#80: Minimal compatibility: Return YDB SDK's YdbTransaction from YOJ's YdbRepositoryTransaction #87

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

nvamelichev
Copy link
Collaborator

Experimental API: Add minimal compatibility between new YDB SDK's YdbTransaction and YOJ's YdbRepositoryTransaction, accessible inside transaction body via

Tx tx = Tx.Current.get();
// YOJ tx:
YdbRepositoryTransaction yojTx = (YdbRepositoryTransaction) tx.getRepositoryTransaction();
// YDB SDK tx:
YdbTransaction ydbTx = yojTx.toSdkTransaction();

In the compatibility wrapper, the getStatusFuture() method always throws UnsupportedOperationException, and other methods are fully functional (getSessionId() will throw if there is no active YDB session, though.)

* @return YDB SDK {@link YdbTransaction} wrapping this {@code YdbRepositoryTransaction}
*/
@ExperimentalApi(issue = "https://github.com/ydb-platform/yoj-project/issues/80")
public YdbTransaction toSdkTransaction() {
Copy link
Contributor

Choose a reason for hiding this comment

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

As an option: we could add RepositoryTransaction.toNativeTransacton to avoid explicit casting.

Anyway, changes are approved.

@nvamelichev nvamelichev merged commit 80f8069 into main Sep 26, 2024
1 check passed
@nvamelichev nvamelichev deleted the ydbtransaction-basic-compatibility branch September 26, 2024 11:41
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