public interface KeyValue
| Modifier and Type | Method and Description |
|---|---|
long |
create(java.lang.String key,
byte[] value)
Put as the value for a key iff the key does not exist (there is no history)
or is deleted (history shows the key is deleted)
|
void |
delete(java.lang.String key)
Soft deletes the key by placing a delete marker.
|
KeyValueEntry |
get(java.lang.String key)
Get the entry for a key
when the key exists and is live (not deleted and not purged)
|
KeyValueEntry |
get(java.lang.String key,
long revision)
Get the specific revision of an entry for a key
when the key exists and is live (not deleted and not purged)
|
java.lang.String |
getBucketName()
Get the name of the bucket.
|
KeyValueStatus |
getStatus()
Get the KeyValueStatus object
|
java.util.List<KeyValueEntry> |
history(java.lang.String key)
Get the history (list of KeyValueEntry) for a key
|
java.util.List<java.lang.String> |
keys()
Get a list of the keys in a bucket.
|
void |
purge(java.lang.String key)
Purge all values/history from the specific key
|
void |
purgeDeletes()
Remove history from all keys that currently are deleted or purged
with using a default KeyValuePurgeOptions
|
void |
purgeDeletes(KeyValuePurgeOptions options)
Remove history from all keys that currently are deleted or purged, considering options.
|
long |
put(java.lang.String key,
byte[] value)
Put a byte[] as the value for a key
|
long |
put(java.lang.String key,
java.lang.Number value)
Put a long as the value for a key
|
long |
put(java.lang.String key,
java.lang.String value)
Put a string as the value for a key
|
long |
update(java.lang.String key,
byte[] value,
long expectedRevision)
Put as the value for a key iff the key exists and its last revision matches the expected
|
long |
update(java.lang.String key,
java.lang.String value,
long expectedRevision)
Put a string as the value for a key iff the key exists and its last revision matches the expected
|
io.nats.client.impl.NatsKeyValueWatchSubscription |
watch(java.lang.String key,
KeyValueWatcher watcher,
KeyValueWatchOption... watchOptions)
Watch updates for a specific key.
|
io.nats.client.impl.NatsKeyValueWatchSubscription |
watchAll(KeyValueWatcher watcher,
KeyValueWatchOption... watchOptions)
Watch updates for all keys.
|
java.lang.String getBucketName()
KeyValueEntry get(java.lang.String key) throws java.io.IOException, JetStreamApiException
key - the keyjava.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.IllegalArgumentException - the server is not JetStream enabledKeyValueEntry get(java.lang.String key, long revision) throws java.io.IOException, JetStreamApiException
key - the keyrevision - the revisionjava.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.IllegalArgumentException - the server is not JetStream enabledlong put(java.lang.String key,
byte[] value)
throws java.io.IOException,
JetStreamApiException
key - the keyvalue - the bytes of the valuejava.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.IllegalArgumentException - the server is not JetStream enabledlong put(java.lang.String key,
java.lang.String value)
throws java.io.IOException,
JetStreamApiException
key - the keyvalue - the UTF-8 stringjava.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.IllegalArgumentException - the server is not JetStream enabledlong put(java.lang.String key,
java.lang.Number value)
throws java.io.IOException,
JetStreamApiException
key - the keyvalue - the numberjava.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.IllegalArgumentException - the server is not JetStream enabledlong create(java.lang.String key,
byte[] value)
throws java.io.IOException,
JetStreamApiException
key - the keyvalue - the bytes of the valuejava.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.IllegalArgumentException - the server is not JetStream enabledlong update(java.lang.String key,
byte[] value,
long expectedRevision)
throws java.io.IOException,
JetStreamApiException
key - the keyvalue - the bytes of the valueexpectedRevision - the expected last revisionjava.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.IllegalArgumentException - the server is not JetStream enabledlong update(java.lang.String key,
java.lang.String value,
long expectedRevision)
throws java.io.IOException,
JetStreamApiException
key - the keyvalue - the UTF-8 stringexpectedRevision - the expected last revisionjava.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.IllegalArgumentException - the server is not JetStream enabledvoid delete(java.lang.String key)
throws java.io.IOException,
JetStreamApiException
key - the keyjava.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datavoid purge(java.lang.String key)
throws java.io.IOException,
JetStreamApiException
key - the keyjava.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the dataio.nats.client.impl.NatsKeyValueWatchSubscription watch(java.lang.String key,
KeyValueWatcher watcher,
KeyValueWatchOption... watchOptions)
throws java.io.IOException,
JetStreamApiException,
java.lang.InterruptedException
key - the keywatcher - the watcher the implementation to receive changeswatchOptions - the watch options to apply. If multiple conflicting options are supplied, the last options wins.java.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.InterruptedException - if the thread is interruptedio.nats.client.impl.NatsKeyValueWatchSubscription watchAll(KeyValueWatcher watcher, KeyValueWatchOption... watchOptions) throws java.io.IOException, JetStreamApiException, java.lang.InterruptedException
watcher - the watcher the implementation to receive changeswatchOptions - the watch options to apply. If multiple conflicting options are supplied, the last options wins.java.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.InterruptedException - if the thread is interruptedjava.util.List<java.lang.String> keys()
throws java.io.IOException,
JetStreamApiException,
java.lang.InterruptedException
java.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.InterruptedException - if the thread is interruptedjava.util.List<KeyValueEntry> history(java.lang.String key) throws java.io.IOException, JetStreamApiException, java.lang.InterruptedException
key - the keyjava.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.InterruptedException - if the thread is interruptedvoid purgeDeletes()
throws java.io.IOException,
JetStreamApiException,
java.lang.InterruptedException
java.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.InterruptedException - if the thread is interruptedvoid purgeDeletes(KeyValuePurgeOptions options) throws java.io.IOException, JetStreamApiException, java.lang.InterruptedException
options - the purge optionsjava.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.InterruptedException - if the thread is interruptedKeyValueStatus getStatus() throws java.io.IOException, JetStreamApiException, java.lang.InterruptedException
java.io.IOException - covers various communication issues with the NATS
server such as timeout or interruptionJetStreamApiException - the request had an error related to the datajava.lang.InterruptedException - if the thread is interrupted