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.
|
void |
delete(java.lang.String key,
long expectedRevision)
Soft deletes the key by placing a delete marker iff the key exists and its last revision matches the expected
|
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 |
purge(java.lang.String key,
long expectedRevision)
Purge all values/history from the specific key iff the key exists and its last revision matches the expected
|
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.util.List<java.lang.String> keys,
KeyValueWatcher watcher,
KeyValueWatchOption... watchOptions)
Watch updates for specific keys.
|
io.nats.client.impl.NatsKeyValueWatchSubscription |
watch(java.util.List<java.lang.String> keys,
KeyValueWatcher watcher,
long fromRevision,
KeyValueWatchOption... watchOptions)
Watch updates for specific keys, starting at a specific revision.
|
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 |
watch(java.lang.String key,
KeyValueWatcher watcher,
long fromRevision,
KeyValueWatchOption... watchOptions)
Watch updates for a specific key, starting at a specific revision.
|
io.nats.client.impl.NatsKeyValueWatchSubscription |
watchAll(KeyValueWatcher watcher,
KeyValueWatchOption... watchOptions)
Watch updates for all keys.
|
io.nats.client.impl.NatsKeyValueWatchSubscription |
watchAll(KeyValueWatcher watcher,
long fromRevision,
KeyValueWatchOption... watchOptions)
Watch updates for all keys starting from a specific revision
|
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 delete(java.lang.String key, long expectedRevision) throws java.io.IOException, JetStreamApiException
key
- the keyexpectedRevision
- 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 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 datavoid purge(java.lang.String key, long expectedRevision) throws java.io.IOException, JetStreamApiException
key
- the keyexpectedRevision
- 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 dataio.nats.client.impl.NatsKeyValueWatchSubscription watch(java.lang.String key, KeyValueWatcher watcher, KeyValueWatchOption... watchOptions) throws java.io.IOException, JetStreamApiException, java.lang.InterruptedException
key
- the key.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 interruptedio.nats.client.impl.NatsKeyValueWatchSubscription watch(java.lang.String key, KeyValueWatcher watcher, long fromRevision, KeyValueWatchOption... watchOptions) throws java.io.IOException, JetStreamApiException, java.lang.InterruptedException
key
- the key.watcher
- the watcher the implementation to receive changesfromRevision
- the revision to start fromwatchOptions
- 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 watch(java.util.List<java.lang.String> keys, KeyValueWatcher watcher, KeyValueWatchOption... watchOptions) throws java.io.IOException, JetStreamApiException, java.lang.InterruptedException
keys
- the keyswatcher
- 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 watch(java.util.List<java.lang.String> keys, KeyValueWatcher watcher, long fromRevision, KeyValueWatchOption... watchOptions) throws java.io.IOException, JetStreamApiException, java.lang.InterruptedException
keys
- the keyswatcher
- the watcher the implementation to receive changesfromRevision
- the revision to start fromwatchOptions
- 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 interruptedio.nats.client.impl.NatsKeyValueWatchSubscription watchAll(KeyValueWatcher watcher, long fromRevision, KeyValueWatchOption... watchOptions) throws java.io.IOException, JetStreamApiException, java.lang.InterruptedException
watcher
- the watcher the implementation to receive changesfromRevision
- the revision to start fromwatchOptions
- 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