public class SimpleMetadataStore extends java.lang.Object implements ConcurrentMetadataStore
MetadataStore that uses a ConcurrentMap for the data store.
The metadata may not be persisted across application restarts, if the provided ConcurrentMap
is an in-memory instance.| Constructor and Description |
|---|
SimpleMetadataStore()
Instantiate a
SimpleMetadataStore using an in-memory ConcurrentHashMap. |
SimpleMetadataStore(java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> metadata)
Instantiate a
SimpleMetadataStore using the provided ConcurrentMap. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
get(java.lang.String key)
Reads a value for the given key from this MetadataStore.
|
void |
put(java.lang.String key,
java.lang.String value)
Writes a key value pair to this MetadataStore.
|
java.lang.String |
putIfAbsent(java.lang.String key,
java.lang.String value)
Atomically insert the key into the store.
|
java.lang.String |
remove(java.lang.String key)
Remove a value for the given key from this MetadataStore.
|
boolean |
replace(java.lang.String key,
java.lang.String oldValue,
java.lang.String newValue)
Atomically replace the value for the key in the store if the old
value matches the oldValue argument.
|
public SimpleMetadataStore()
SimpleMetadataStore using an in-memory ConcurrentHashMap.public SimpleMetadataStore(java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> metadata)
SimpleMetadataStore using the provided ConcurrentMap.
The implementation may be a distributed map provided by projects such as Redis and Hazelcast.metadata - the ConcurrentMap instance for metadata.public void put(java.lang.String key,
java.lang.String value)
MetadataStoreput in interface MetadataStorekey - The key.value - The value.public java.lang.String get(java.lang.String key)
MetadataStoreget in interface MetadataStorekey - The key.public java.lang.String remove(java.lang.String key)
MetadataStoreremove in interface MetadataStorekey - The key.public java.lang.String putIfAbsent(java.lang.String key,
java.lang.String value)
ConcurrentMetadataStoreputIfAbsent in interface ConcurrentMetadataStorekey - The key.value - The value.public boolean replace(java.lang.String key,
java.lang.String oldValue,
java.lang.String newValue)
ConcurrentMetadataStorereplace in interface ConcurrentMetadataStorekey - The key.oldValue - The old value.newValue - The new value.