Package kvd.client
Interface KvdOperations
-
- All Known Implementing Classes:
KvdClient
,KvdTransaction
public interface KvdOperations
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
contains(byte[] key)
Returns true if a mapping for the specified key exists on the server.default boolean
contains(String key)
Returns true if a mapping for the specified key exists on the server.Future<Boolean>
containsAsync(byte[] key)
The returnedFuture
evaluates to true if the key exists on the server, false otherwisedefault Future<Boolean>
containsAsync(String key)
The returnedFuture
evaluates to true if the key exists on the server, false otherwisedefault InputStream
get(byte[] key)
Convenience method that callsgetAsync(String)
and waits for theFuture
to complete.default InputStream
get(String key)
Convenience method that callsgetAsync(String)
and waits for theFuture
to complete.Future<InputStream>
getAsync(byte[] key)
Returns the value to which the specified key is mappeddefault Future<InputStream>
getAsync(String key)
Returns the value to which the specified key is mappeddefault byte[]
getBytes(byte[] key)
Get abyte[]
value.default String
getString(String key)
Convenience method that gets aString
value.default String
getString(String key, String charsetName)
Convenience method that gets aString
value.default OutputStream
put(byte[] key)
Put a new value or replace an existing.default OutputStream
put(String key)
Put a new value or replace an existing.Future<OutputStream>
putAsync(byte[] key)
Put a new value or replace an existing.default Future<OutputStream>
putAsync(String key)
Put a new value or replace an existing.default void
putBytes(byte[] key, byte[] value)
Put a byte array key/value pair.default void
putString(String key, String value)
Convenience method that puts aString
value.default void
putString(String key, String value, String charsetName)
Convenience method that puts aString
value.default boolean
remove(byte[] key)
Removes the mapping for the specified key from the server.default boolean
remove(String key)
Removes the mapping for the specified key from the server.Future<Boolean>
removeAsync(byte[] key)
Removes the mapping for the specified key from the server.default Future<Boolean>
removeAsync(String key)
Removes the mapping for the specified key from the server.
-
-
-
Method Detail
-
putAsync
Future<OutputStream> putAsync(byte[] key)
Put a new value or replace an existing.- Parameters:
key
- key with which the specified value is to be associated- Returns:
Future
that evaluates either to anOutputStream
to be used to stream the value in. or fails (e.g. on optimistic lock or deadlock). Close theOutputStream
to signal that the value is complete.
-
getAsync
Future<InputStream> getAsync(byte[] key)
Returns the value to which the specified key is mapped- Parameters:
key
- the key whose associated value is to be returned- Returns:
Future
that evaluates either to anInputStream
for keys that exist ornull
for keys that don't exist on the server.
-
containsAsync
Future<Boolean> containsAsync(byte[] key)
The returnedFuture
evaluates to true if the key exists on the server, false otherwise- Parameters:
key
- The key whose presence is to be tested- Returns:
Future
evaluates totrue
if the key exists on the server,false
otherwise
-
removeAsync
Future<Boolean> removeAsync(byte[] key)
Removes the mapping for the specified key from the server.- Parameters:
key
- key whose mapping is to be removed- Returns:
Future
which evaluates totrue
if the key/value was removed from the server,false
otherwise.
-
putAsync
default Future<OutputStream> putAsync(String key)
Put a new value or replace an existing.- Parameters:
key
- key with which the specified value is to be associated- Returns:
Future
that evaluates either to anOutputStream
to be used to stream the value in. or fails (e.g. on optimistic lock or deadlock). Close theOutputStream
to signal that the value is complete.
-
put
default OutputStream put(String key)
Put a new value or replace an existing.- Parameters:
key
- key with which the specified value is to be associated- Returns:
OutputStream
to be used to stream the value in. Close theOutputStream
to signal that the value is complete.
-
put
default OutputStream put(byte[] key)
Put a new value or replace an existing.- Parameters:
key
- key with which the specified value is to be associated- Returns:
OutputStream
to be used to stream the value in. Close theOutputStream
to signal that the value is complete.
-
getAsync
default Future<InputStream> getAsync(String key)
Returns the value to which the specified key is mapped- Parameters:
key
- the key whose associated value is to be returned- Returns:
Future
that evaluates either to anInputStream
for keys that exist ornull
for keys that don't exist on the server.
-
get
default InputStream get(String key)
Convenience method that callsgetAsync(String)
and waits for theFuture
to complete.- Parameters:
key
- key the key whose associated value is to be returned- Returns:
- the
InputStream
for keys that exist ornull
for keys that don't exist on the server.
-
get
default InputStream get(byte[] key)
Convenience method that callsgetAsync(String)
and waits for theFuture
to complete.- Parameters:
key
- key the key whose associated value is to be returned- Returns:
- the
InputStream
for keys that exist ornull
for keys that don't exist on the server.
-
putString
default void putString(String key, String value, String charsetName)
Convenience method that puts aString
value.- Parameters:
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key.null
values are not supportedcharsetName
- the name of the requested charset,null
means platform default
-
putString
default void putString(String key, String value)
Convenience method that puts aString
value. Uses platform default charset- Parameters:
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key.null
values are not supported
-
getString
default String getString(String key, String charsetName)
Convenience method that gets aString
value.- Parameters:
key
- the key whose associated value is to be returnedcharsetName
- the name of the requested charset,null
means platform default- Returns:
String
value that is associated with the key ornull
if the key does not exist on the server.
-
getString
default String getString(String key)
Convenience method that gets aString
value.- Parameters:
key
- the key whose associated value is to be returned- Returns:
String
value that is associated with the key ornull
. Uses platform default charset if the key does not exist on the server.
-
containsAsync
default Future<Boolean> containsAsync(String key)
The returnedFuture
evaluates to true if the key exists on the server, false otherwise- Parameters:
key
- The key whose presence is to be tested- Returns:
Future
evaluates totrue
if the key exists on the server,false
otherwise
-
contains
default boolean contains(String key)
Returns true if a mapping for the specified key exists on the server.- Parameters:
key
- the key whose presence is to be tested- Returns:
true
if the key exists on the server,false
otherwise.
-
contains
default boolean contains(byte[] key)
Returns true if a mapping for the specified key exists on the server.- Parameters:
key
- the key whose presence is to be tested- Returns:
true
if the key exists on the server,false
otherwise.
-
removeAsync
default Future<Boolean> removeAsync(String key)
Removes the mapping for the specified key from the server.- Parameters:
key
- key whose mapping is to be removed- Returns:
Future
which evaluates totrue
if the key/value was removed from the server,false
otherwise.
-
remove
default boolean remove(String key)
Removes the mapping for the specified key from the server.- Parameters:
key
- key key whose mapping is to be removed- Returns:
true
if the key/value was removed from the server,false
otherwise.
-
remove
default boolean remove(byte[] key)
Removes the mapping for the specified key from the server.- Parameters:
key
- key key whose mapping is to be removed- Returns:
true
if the key/value was removed from the server,false
otherwise.
-
putBytes
default void putBytes(byte[] key, byte[] value)
Put a byte array key/value pair.- Parameters:
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key.null
values are not supported
-
getBytes
default byte[] getBytes(byte[] key)
Get abyte[]
value.- Parameters:
key
- the key whose associated value is to be returned- Returns:
byte[]
value that is associated with the key ornull
if the key does not exist on the server.
-
-