Open
Conversation
|
https://github.com/etcd-io/etcd/blob/main/client/v3/op.go#L376 -- it's how etcdctl do it. |
stalkerg
reviewed
May 9, 2024
| @@ -362,10 +362,7 @@ def get_prefix( | |||
| encoding='utf-8', | |||
| ): | |||
| encoded_key = key.encode(encoding) | |||
There was a problem hiding this comment.
we don't need this encode here we already do it inside new function. Same for other cases.
There was a problem hiding this comment.
or new function shouldn't worry about conversion and should consume only bytes
|
@kyujin-cho please review this PR. |
|
@kyujin-cho sorry, but ping. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
We are adding +1 to the last byte excluding
/, because of this, we are not receiving events. Escpecially when you set the persmission based on the path like below.role permission
watch prefix for
app_data/clients/clientx2/becomesb'app_data/clients/clientx3/'but it supposed to beb'app_data/clients/clientx30'(As slash is part of the key, we shall add +1 to the slash)Fix
As per etcd3 spec https://etcd.io/docs/v3.3/learning/api/#:~:text=revision%20was%20committed.-,Key%20ranges,-The%20etcd3%20data
Some implementations
https://github.com/etcd-io/etcd/blob/main/client/v3/op.go#L376
https://github.com/gaopeiliang/aioetcd3/blob/4709a2a412cc81d47a8a262e569b4cd62a7659d4/aioetcd3/utils.py#L14