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

transactions wrap whole SetRequest processing #32

Merged
merged 1 commit into from
Dec 18, 2023
Merged

Conversation

martin-volf
Copy link
Contributor

Adapters are required to provide context manager for transaction contexts; the update operations are then invoked on the transaction.


@abstractmethod
def delete(self, prefix, paths):
def update_transaction(self, prefix) -> ContextManager[UpdateTransaction]:
Copy link
Contributor

Choose a reason for hiding this comment

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

update_transaction here imho reads like "verb, subject", maybe rename? handler() / manager() or similar...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was considering a different name, but note it is a context manager, so its usage is like

with update_transaction(prefix) as trans:
    ....

and words like "handler" would be at least redundant.

@@ -167,8 +167,8 @@ def Set(self, request, context):
self.verify_updates_encoding_supported(request.update, adapter, context)
# TODO for now we do not process replace list
# TODO: changes should be part of one transaction (gNMI spec. 3.4.3)
Copy link
Contributor

Choose a reason for hiding this comment

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

this one comment line is now resolved? (with .. as trans:)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, will remove

@martin-volf martin-volf merged commit 3e58345 into main Dec 18, 2023
1 check passed
@martin-volf martin-volf deleted the mv/trans-order branch December 18, 2023 17:01
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.

3 participants