Class NoOpJsonStore
- java.lang.Object
-
- org.opennms.features.distributed.kvstore.api.AbstractKeyValueStore<T>
-
- org.opennms.features.distributed.kvstore.api.AbstractAsyncKeyValueStore<String>
-
- org.opennms.features.distributed.kvstore.json.noop.NoOpJsonStore
-
- All Implemented Interfaces:
JsonStore
,KeyValueStore<String>
public class NoOpJsonStore extends AbstractAsyncKeyValueStore<String> implements JsonStore
-
-
Constructor Summary
Constructors Constructor Description NoOpJsonStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(String key, String context)
Map<String,String>
enumerateContext(String context)
Optional<String>
get(String key, String context)
Optional<Optional<String>>
getIfStale(String key, String context, long timestamp)
OptionalLong
getLastUpdated(String key, String context)
String
getName()
long
put(String key, String value, String context, Integer ttlInSeconds)
Put a value with a suggested time-to-live after which the value should be expired and removed from the store.-
Methods inherited from class org.opennms.features.distributed.kvstore.api.AbstractAsyncKeyValueStore
deleteAsync, enumerateContextAsync, getAsync, getIfStaleAsync, getLastUpdatedAsync, putAsync, truncateContextAsync
-
Methods inherited from class org.opennms.features.distributed.kvstore.api.AbstractKeyValueStore
put, putAsync, truncateContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opennms.features.distributed.kvstore.api.KeyValueStore
deleteAsync, enumerateContextAsync, getAsync, getIfStaleAsync, getLastUpdatedAsync, put, putAsync, putAsync, truncateContext, truncateContextAsync
-
-
-
-
Method Detail
-
put
public long put(String key, String value, String context, Integer ttlInSeconds)
Description copied from interface:KeyValueStore
Put a value with a suggested time-to-live after which the value should be expired and removed from the store.Records are expired on a best effort basis and depending on the implementation it is possible to get an expired record.
- Specified by:
put
in interfaceKeyValueStore<String>
context
- a context used to differentiate between keys with the same name (forms a compound key)ttlInSeconds
- the time to live in seconds for this key or no ttl if null- Returns:
- the timestamp the value was persisted with
-
get
public Optional<String> get(String key, String context)
- Specified by:
get
in interfaceKeyValueStore<String>
context
- a context used to differentiate between keys with the same name (forms a compound key)- Returns:
- an optional containing the value if present or empty if the key did not exist
-
getIfStale
public Optional<Optional<String>> getIfStale(String key, String context, long timestamp)
- Specified by:
getIfStale
in interfaceKeyValueStore<String>
context
- a context used to differentiate between keys with the same name (forms a compound key)timestamp
- the timestamp of the last known state such that if an record with a more recent timestamp is found the provided timestamp will be considered stale and the new record will be returned- Returns:
- an optional that will be empty if the key was not found or will contain another optional that will be empty if not stale or contain the value if stale
-
getLastUpdated
public OptionalLong getLastUpdated(String key, String context)
- Specified by:
getLastUpdated
in interfaceKeyValueStore<String>
context
- a context used to differentiate between keys with the same name (forms a compound key)- Returns:
- an optional containing the timestamp the key's value was last updated or empty if the key did not exist
-
getName
public String getName()
- Specified by:
getName
in interfaceKeyValueStore<String>
- Returns:
- the name of the backing implementation
-
enumerateContext
public Map<String,String> enumerateContext(String context)
- Specified by:
enumerateContext
in interfaceKeyValueStore<String>
- Parameters:
context
- a context used to differentiate between keys with the same name (forms a compound key)- Returns:
- a map of all the records matching the given context where the map's key is the record's key and the map's value is the records value
-
delete
public void delete(String key, String context)
- Specified by:
delete
in interfaceKeyValueStore<String>
context
- a context used to differentiate between keys with the same name (forms a compound key)
-
-