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

Implement transactions in v3 API #98

Merged
merged 3 commits into from Jul 22, 2023
Merged

Conversation

simolus3
Copy link
Contributor

This implements the run and runTx methods in the v3 draft.

I think much of the confusion related to exceptions in the old API comes from the fact that not awaiting statements was supported. Given that this is rarely a good idea, we can just forbid this in the v3 API and always rethrow the original exception.

To implement this, I've lifted the _operationLock from the connection class into a shared session class. This allows transactions to use their own _operationLock while keeping the one from the connection locked the entire time.

lib/src/v3/connection.dart Show resolved Hide resolved
transformer: StreamChannelTransformer(
StreamTransformer.fromHandlers(
handleData: (data, sink) {
print('[IN]: $data');
Copy link
Owner

Choose a reason for hiding this comment

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

Do we want these print statements in the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, my bad 🤦 They're left over from me debugging tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar to what the docker_process package is doing, I've replaced them with a logger that is disabled by default. That way, to debug failing tests, it's easy to enable the logs to see where it's going wrong.
If you think that code shouldn't be in tests I can remove it as well.

@isoos isoos merged commit 001d9bf into isoos:master Jul 22, 2023
1 check passed
@simolus3 simolus3 deleted the v3-transactions branch July 22, 2023 20:06
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.

None yet

2 participants