watch_conn() = #{http2_pid => pid(), monitor_ref => reference(), stream_ref => reference(), unprocessed => binary(), revision => integer(), compact_revision => integer(), watch_id => integer(), response => router_pb:'Etcd.WatchResponse'()}
new/0 | init watch request. |
rev/1 | Rev returns the current revision of the KV the stream watches on. |
unwatch/2 | Cancel watching so that no more events are transmitted. |
watch/2 | @equiv watch(name(), context(), 5000). |
watch/3 | Watch watches for events happening or that have happened. |
watch_stream/2 | Streams the next batch of events from the given message. |
with_filter_delete/1 | discards DELETE events from the watcher. |
with_filter_put/1 | discards PUT events from the watcher. |
with_fragment/1 | WithFragment to receive raw watch response with fragmentation. |
with_from_key/1 | Specifies the range of get , delete requests
to be equal or greater than the key in the argument. |
with_key/2 | Sets the byte slice for the Op's key . |
with_prefix/1 | Enables watch requests to operate
on the keys with matching prefix. |
with_prev_kv/1 | Get the previous key-value pair before the event happens. |
with_progress_notify/1 | Make watch server send periodic progress updates every 10 minutes when there is no incoming events. |
with_range_end/2 | Sets the byte slice for the Op's range_end . |
with_start_revision/2 | |
with_watch_id/2 | AutoWatchID is the watcher ID passed in WatchStream.Watch when no user-provided ID is available, an ID will automatically be assigned. |
new() -> context()
init watch request
rev(X1) -> any()
Rev returns the current revision of the KV the stream watches on.
unwatch(WatchConn::watch_conn(), Timeout) -> {ok, router_pb:'Etcd.WatchResponse'(), OtherEvents} | {error, {stream_error | conn_error | http2_down, term()} | timeout, OtherEvents}
Cancel watching so that no more events are transmitted. This is a synchronous operation. Other change events will be returned in OtherEvents when these events arrive between the request and the response.
watch(Name::name(), CreateReq::context()) -> {ok, watch_conn()} | {error, {stream_error | conn_error | http2_down, term()} | timeout}
@equiv watch(name(), context(), 5000).
watch(Name::name(), CreateReq::context(), Timeout::pos_integer()) -> {ok, watch_conn()} | {error, {stream_error | conn_error | http2_down, term()} | timeout}
Watch watches for events happening or that have happened. Both input and output are streams; the input stream is for creating watchers and the output stream sends events. One watch RPC can watch on multiple key ranges, streaming events for several watches at once. The entire event history can be watched starting from the last compaction revision.
Watch creates a watcher. The watcher watches the events happening or happened on the given key or range [key, end) from the given startRev.
The whole event history can be watched unless compacted.
If startRev <= 0
, watch observes events after currentRev.
watch_stream(Conn::watch_conn(), Message) -> {ok, watch_conn(), router_pb:'Etcd.WatchResponse'()} | {more, watch_conn()} | unknown | {error, {stream_error | conn_error | http2_down, term()}}
Streams the next batch of events from the given message. This function processes a "message" which can be any term, but should be a message received by the process that owns the stream_ref. Processing a message means that this function will parse it and check if it's a message that is directed to this connection, that is, a gun_* message received on the gun connection. If it is, then this function will parse the message, turn it into watch responses, and possibly take action given the responses. If there's no error, this function returns {ok, WatchConn, 'Etcd.WatchResponse'()}|{more, WatchConn} If there's an error, {error, {stream_error | conn_error | http2_down, term()} | timeout} is returned. If the given message is not from the gun connection, this function returns unknown.
discards DELETE events from the watcher.
discards PUT events from the watcher.
WithFragment to receive raw watch response with fragmentation. Fragmentation is disabled by default. If fragmentation is enabled, etcd watch server will split watch response before sending to clients when the total size of watch events exceed server-side request limit. The default server-side request limit is 1.5 MiB, which can be configured as "--max-request-bytes" flag value + gRPC-overhead 512 bytes.
Specifies the range of get
, delete
requests
to be equal or greater than the key in the argument.
Sets the byte slice for the Op's key
.
Enables watch
requests to operate
on the keys with matching prefix. For example, watch("foo", with_prefix())
can return 'foo1', 'foo2', and so on.
Get the previous key-value pair before the event happens. If the previous KV is already compacted, nothing will be returned.
Make watch server send periodic progress updates every 10 minutes when there is no incoming events. Progress updates have zero events in WatchResponse.
Sets the byte slice for the Op's range_end
.
with_start_revision(Context, Rev) -> any()
with_watch_id(Context, WatchId) -> any()
AutoWatchID is the watcher ID passed in WatchStream.Watch when no user-provided ID is available, an ID will automatically be assigned.
Generated by EDoc