Skip to content

WIP: Re-design watch API#1

Closed
belltoy wants to merge 2 commits into
fix/watchfrom
feature/watch-stream
Closed

WIP: Re-design watch API#1
belltoy wants to merge 2 commits into
fix/watchfrom
feature/watch-stream

Conversation

@belltoy

@belltoy belltoy commented Jun 26, 2025

Copy link
Copy Markdown
Owner

Based on etcdv3#104

The WatchClient is not a high level watcher, it is just a watch API stub. So it should be only responsible for sending requests and receiving responses. Let the high level watcher decide what to do if received an unexpected response.

- WatchClient::watch(key: impl Into<Vec<u8>>, options: Option<WatchOptions>) -> Result<(WatchResponse, Watcher, WatchStream)>
+ WatchClient::watch(key: impl Into<Vec<u8>>, options: Option<WatchOptions>) -> Result<WatchStream>

The new WatchStream is different from the old version. It represents underlying bidirectional watch stream (HTTP2 stream). So it can be used to send requests and receive responses and events.

It's the user's responsibility to check the received response is a response or an event, if it is created successfully or not, or if it is a cancel response.

@belltoy belltoy changed the title WIP: Try to re-design watch API WIP: Re-design watch API Jun 26, 2025
@belltoy belltoy force-pushed the feature/watch-stream branch from 09df58c to 13d70ba Compare June 26, 2025 07:53
@belltoy belltoy force-pushed the feature/watch-stream branch from 13d70ba to 7e586ee Compare June 27, 2025 02:00
@belltoy

belltoy commented Jul 9, 2025

Copy link
Copy Markdown
Owner Author

Moved to etcdv3#108

@belltoy belltoy closed this Jul 9, 2025
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.

1 participant