Class GetOption.Builder
- Enclosing class:
- GetOption
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the GetOption.isPrefix(boolean prefix) Enables 'Get' requests to obtain all the keys by prefix.withCountOnly(boolean countOnly) Set the get request to only return count of the keys.withKeysOnly(boolean keysOnly) Set the get request to only return keys.withLimit(long limit) Limit the number of keys to return for a get request.withMaxCreateRevision(long createRevision) Limit returned keys to those with create revision less or equal than the provided value.withMaxModRevision(long modRevision) Limit returned keys to those with mod revision less or equal than the provided value.withMinCreateRevision(long createRevision) Limit returned keys to those with create revision greater or equal than the provided value.withMinModRevision(long modRevision) Limit returned keys to those with mod revision greater or equal than the provided value.withPrefix(ByteSequence prefix) Deprecated.withRange(ByteSequence endKey) Set the end key of the get request.withRevision(long revision) Provide the revision to use for the get request.withSerializable(boolean serializable) Set the get request to be a serializable get request.Sort the return key value pairs in the provided field.withSortOrder(GetOption.SortOrder order) Sort the return key value pairs in the provided order.
-
Method Details
-
withLimit
Limit the number of keys to return for a get request. By default is 0 - no limitation.Note this filter does not affect the count field in GetResponse.
GetResponse.getCount()always counts the number of keys matched on a range, independent of filters. For the same reason, it would be meaningless to mix setting this option with the count only option.- Parameters:
limit- the maximum number of keys to return for a get request.- Returns:
- builder
-
withRevision
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
Sort the return key value pairs in the provided order.- Parameters:
order- order to sort the returned key value pairs.- Returns:
- builder
-
withSortField
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
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. Note this is a tradeoff with strict consistency so it should be used with care in situations where reading stale is acceptable.
- Parameters:
serializable- is the get request a serializable get request.- Returns:
- builder
-
withKeysOnly
Set the get request to only return keys.- Parameters:
keysOnly- flag to only return keys- Returns:
- builder
-
withCountOnly
Set the get request to only return count of the keys.- Parameters:
countOnly- flag to only return count of the keys- Returns:
- builder
-
withRange
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
Enables 'Get' requests to obtain all the keys by prefix.- Parameters:
prefix- flag to obtain all the keys by prefix- Returns:
- builder
-
withPrefix
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
Limit returned keys to those with create revision greater or equal 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.Note this filter does not affect the count field in GetResponse.
GetResponse.getCount()always counts the number of keys matched on a range, independent of filters. For the same reason, it would be meaningless to mix setting this option with the count only option.- Parameters:
createRevision- create revision- Returns:
- builder
-
withMaxCreateRevision
Limit returned keys to those with create revision less or equal 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.Note this filter does not affect the count field in GetResponse.
GetResponse.getCount()always counts the number of keys matched on a range, independent of filters. For the same reason, it would be meaningless to mix setting this option with the count only option.- Parameters:
createRevision- create revision- Returns:
- builder
-
withMinModRevision
Limit returned keys to those with mod revision greater or equal 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.Note this filter does not affect the count field in GetResponse.
GetResponse.getCount()always counts the number of keys matched on a range, independent of filters. For the same reason, it would be meaningless to mix setting this option with the count only option.- Parameters:
modRevision- mod revision- Returns:
- this builder instance
-
withMaxModRevision
Limit returned keys to those with mod revision less or equal 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.Note this filter does not affect the count field in GetResponse.
GetResponse.getCount()always counts the number of keys matched on a range, independent of filters. For the same reason, it would be meaningless to mix setting this option with the count only option.- Parameters:
modRevision- mod revision- Returns:
- this builder instance
-
build
Build the GetOption.- Returns:
- the GetOption
-
isPrefix(boolean)instead.