Package io.etcd.jetcd.options
Class WatchOption.Builder
- java.lang.Object
-
- io.etcd.jetcd.options.WatchOption.Builder
-
- Enclosing class:
- WatchOption
public static class WatchOption.Builder extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description WatchOptionbuild()WatchOption.BuilderisPrefix(boolean prefix)Enables watch watch all the keys by prefix.WatchOption.BuilderwithNoDelete(boolean noDelete)filter out delete event in server side.WatchOption.BuilderwithNoPut(boolean noPut)filter out put event in server side.WatchOption.BuilderwithPrefix(ByteSequence prefix)Deprecated.UseisPrefix(boolean)instead.WatchOption.BuilderwithPrevKV(boolean prevKV)When prevKV is set, created watcher gets the previous KV before the event happens, if the previous KV is not compacted.WatchOption.BuilderwithProgressNotify(boolean progressNotify)When progressNotify is set, the watch server send periodic progress updates.WatchOption.BuilderwithRange(ByteSequence endKey)Set the end key of the watch request.WatchOption.BuilderwithRequireLeader(boolean requireLeader)When creating the watch streaming stub, use the REQUIRED_LEADER Metadata annotation, which ensures the stream will error out if quorum is lost by the server the stream is connected to.WatchOption.BuilderwithRevision(long revision)Provide the revision to use for the watch request.
-
-
-
Method Detail
-
withRevision
public WatchOption.Builder withRevision(long revision)
Provide the revision to use for the watch request.If the revision is less or equal to zero, the get is over the newest key-value store.
If the revision has been compacted, ErrCompacted is returned as a response.
- Parameters:
revision- the revision to get.- Returns:
- builder
-
withRange
public WatchOption.Builder withRange(ByteSequence endKey)
Set the end key of the watch request. If it is set, the get request will return the keys from key to endKey (exclusive).If end key is '\0', the range is all keys >= key.
If the end key is one bit larger than the given key, then it gets all keys with the prefix (the given key).
If both key and end key are '\0', it returns all keys.
- Parameters:
endKey- end key- Returns:
- builder
-
withPrevKV
public WatchOption.Builder withPrevKV(boolean prevKV)
When prevKV is set, created watcher gets the previous KV before the event happens, if the previous KV is not compacted.- Parameters:
prevKV- configure the watcher to receive previous KV.- Returns:
- builder
-
withProgressNotify
public WatchOption.Builder withProgressNotify(boolean progressNotify)
When progressNotify is set, the watch server send periodic progress updates. Progress updates have zero events in WatchResponse.- Parameters:
progressNotify- configure the watcher to receive progress updates.- Returns:
- builder
-
withNoPut
public WatchOption.Builder withNoPut(boolean noPut)
filter out put event in server side.- Parameters:
noPut- filter out put event- Returns:
- builder
-
withNoDelete
public WatchOption.Builder withNoDelete(boolean noDelete)
filter out delete event in server side.- Parameters:
noDelete- filter out delete event- Returns:
- builder
-
isPrefix
public WatchOption.Builder isPrefix(boolean prefix)
Enables watch watch all the keys by prefix.- Parameters:
prefix- flag to watch all the keys by prefix- Returns:
- builder
-
withPrefix
@Deprecated public WatchOption.Builder withPrefix(ByteSequence prefix)
Deprecated.UseisPrefix(boolean)instead.Enables watch all the keys with matching prefix.- Parameters:
prefix- the common prefix of all the keys that you want to watch- Returns:
- builder
-
withRequireLeader
public WatchOption.Builder withRequireLeader(boolean requireLeader)
When creating the watch streaming stub, use the REQUIRED_LEADER Metadata annotation, which ensures the stream will error out if quorum is lost by the server the stream is connected to. Without this option, a stream running against a server that is out of quorum simply goes silent.- Parameters:
requireLeader- require quorum for watch stream creation.- Returns:
- builder
-
build
public WatchOption build()
-
-