Package io.etcd.jetcd.options
Class GetOption.Builder
- java.lang.Object
-
- io.etcd.jetcd.options.GetOption.Builder
-
- Enclosing class:
- GetOption
public static class GetOption.Builder extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description GetOptionbuild()Build the GetOption.GetOption.BuilderisPrefix(boolean prefix)Enables 'Get' requests to obtain all the keys by prefix.GetOption.BuilderwithCountOnly(boolean countOnly)Set the get request to only return count of the keys.GetOption.BuilderwithKeysOnly(boolean keysOnly)Set the get request to only return keys.GetOption.BuilderwithLimit(long limit)Limit the number of keys to return for a get request.GetOption.BuilderwithMaxCreateRevision(long createRevision)Limit returned keys to those with create revision less than the provided value.GetOption.BuilderwithMaxModRevision(long modRevision)Limit returned keys to those with mod revision less than the provided value.GetOption.BuilderwithMinCreateRevision(long createRevision)Limit returned keys to those with create revision greater than the provided value.GetOption.BuilderwithMinModRevision(long modRevision)Limit returned keys to those with mod revision greater than the provided value.GetOption.BuilderwithPrefix(ByteSequence prefix)Deprecated.UseisPrefix(boolean)instead.GetOption.BuilderwithRange(ByteSequence endKey)Set the end key of the get request.GetOption.BuilderwithRevision(long revision)Provide the revision to use for the get request.GetOption.BuilderwithSerializable(boolean serializable)Set the get request to be a serializable get request.GetOption.BuilderwithSortField(GetOption.SortTarget field)Sort the return key value pairs in the provided field.GetOption.BuilderwithSortOrder(GetOption.SortOrder order)Sort the return key value pairs in the provided order.
-
-
-
Method Detail
-
withLimit
public GetOption.Builder withLimit(long limit)
Limit the number of keys to return for a get request. By default is 0 - no limitation.- Parameters:
limit- the maximum number of keys to return for a get request.- Returns:
- builder
-
withRevision
public GetOption.Builder withRevision(long revision)
Provide the revision to use for the get 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
-
withSortOrder
public GetOption.Builder withSortOrder(GetOption.SortOrder order)
Sort the return key value pairs in the provided order.- Parameters:
order- order to sort the returned key value pairs.- Returns:
- builder
-
withSortField
public GetOption.Builder withSortField(GetOption.SortTarget field)
Sort the return key value pairs in the provided field.- Parameters:
field- field to sort the key value pairs by the provided- Returns:
- builder
-
withSerializable
public GetOption.Builder withSerializable(boolean serializable)
Set the get request to be a serializable get request.Get requests are linearizable by default. For better performance, a serializable get request is served locally without needing to reach consensus with other nodes in the cluster.
- Parameters:
serializable- is the get request a serializable get request.- Returns:
- builder
-
withKeysOnly
public GetOption.Builder withKeysOnly(boolean keysOnly)
Set the get request to only return keys.- Parameters:
keysOnly- flag to only return keys- Returns:
- builder
-
withCountOnly
public GetOption.Builder withCountOnly(boolean countOnly)
Set the get request to only return count of the keys.- Parameters:
countOnly- flag to only return count of the keys- Returns:
- builder
-
withRange
public GetOption.Builder withRange(ByteSequence endKey)
Set the end key of the get 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
-
isPrefix
public GetOption.Builder isPrefix(boolean prefix)
Enables 'Get' requests to obtain all the keys by prefix.- Parameters:
prefix- flag to obtain all the keys by prefix- Returns:
- builder
-
withPrefix
@Deprecated public GetOption.Builder withPrefix(ByteSequence prefix)
Deprecated.UseisPrefix(boolean)instead.Enables 'Get' requests to obtain all the keys with matching prefix.You should pass the key that is passed into
KV.getmethod into this method as the given key.- Parameters:
prefix- the common prefix of all the keys that you want to get- Returns:
- builder
-
withMinCreateRevision
public GetOption.Builder withMinCreateRevision(long createRevision)
Limit returned keys to those with create revision greater than the provided value. min_create_revision is the lower bound for returned key create revisions; all keys with lesser create revisions will be filtered away.- Parameters:
createRevision- create revision- Returns:
- builder
-
withMaxCreateRevision
public GetOption.Builder withMaxCreateRevision(long createRevision)
Limit returned keys to those with create revision less than the provided value. max_create_revision is the upper bound for returned key create revisions; all keys with greater create revisions will be filtered away.- Parameters:
createRevision- create revision- Returns:
- builder
-
withMinModRevision
public GetOption.Builder withMinModRevision(long modRevision)
Limit returned keys to those with mod revision greater than the provided value. min_mod_revision is the lower bound for returned key mod revisions; all keys with lesser mod revisions will be filtered away.- Parameters:
modRevision- mod revision- Returns:
- this builder instance
-
withMaxModRevision
public GetOption.Builder withMaxModRevision(long modRevision)
Limit returned keys to those with mod revision less than the provided value. max_mod_revision is the upper bound for returned key mod revisions; all keys with greater mod revisions will be filtered away.- Parameters:
modRevision- mod revision- Returns:
- this builder instance
-
build
public GetOption build()
Build the GetOption.- Returns:
- the GetOption
-
-