fix: change watch API#104
Closed
belltoy wants to merge 1 commit into
Closed
Conversation
5ba8852 to
9017eac
Compare
Contributor
Author
Failure in the clippy check, but didn't change the |
051365b to
34de556
Compare
The `watch` function returns a tuple `(WatchResponse, Watcher, WatchStream)`, the first element in the returned tuple is the response to the first create watch request. More importantly, the etcd `Watch` API behaves differently than other unary RPC. It doesn't send grpc-status in the trailers if something goes wrong. Instead, we must solve the result via the `WatchResponse` and its corresponding request.
Contributor
Author
|
use #108 |
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.
The current
WatchClient::watchfunction await the first response to the create request and keep the watch_id in theWatcher. This is not necessary, either a good idea for a etcd watch API.The etcd
WatchAPI behaves differently than other unary RPC. It doesn't send grpc-status in the trailers if something goes wrong. Instead, we must solve the result via theWatchResponseand its corresponding request.Changes
The
watchfunction returns a tuple(WatchResponse, Watcher, WatchStream), the first element in the returned tuple is the response to the first create watch request.The
Watcherstruct doesn't hold the first watch_id inside. TheWatcher::cancelfunction will always need awatch_idas parameter.The returned
WatchResponseto the firstWatchCreateRequestincludes more useful information to upstream applications. For example, if the request with a particular start_revision which may have been compacted in the server, then the client should never retry with the same start_revision.BTW, in this PR, I still await the first response and try to solve the result of the first create request. But I prefer leaving it to the higher level watcher: belltoy#1