public class ZookeeperPersistentStore<V> extends BasePersistentStore<V> implements VersionedPersistentStore<V>
PersistentStore
.Constructor and Description |
---|
ZookeeperPersistentStore(org.apache.curator.framework.CuratorFramework framework,
PersistentStoreConfig<V> config) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
contains(String key)
Checks if lookup key is present in store.
|
boolean |
contains(String key,
DataChangeVersion version)
Checks if lookup key is present in store.
|
void |
delete(String key)
Removes the value corresponding to the given key if exists, nothing happens otherwise.
|
V |
get(String key)
Returns the value for the given key if exists, null otherwise.
|
V |
get(String key,
boolean consistencyFlag,
DataChangeVersion version) |
V |
get(String key,
DataChangeVersion version)
Returns the value for the given key if exists, null otherwise.
|
PersistentStoreMode |
getMode()
Returns storage
mode of this store. |
Iterator<Map.Entry<String,V>> |
getRange(int skip,
int take)
Returns an iterator of desired number of entries offsetting by the skip value.
|
void |
put(String key,
V value)
Stores the (key, value) tuple in the store.
|
void |
put(String key,
V value,
DataChangeVersion version)
Stores the (key, value) tuple in the store.
|
boolean |
putIfAbsent(String key,
V value)
Stores the (key, value) tuple in the store only if it does not exists.
|
void |
start() |
getAll
public ZookeeperPersistentStore(org.apache.curator.framework.CuratorFramework framework, PersistentStoreConfig<V> config) throws StoreException
StoreException
public PersistentStoreMode getMode()
Store
mode
of this store.public boolean contains(String key)
PersistentStore
contains
in interface PersistentStore<V>
key
- lookup keypublic boolean contains(String key, DataChangeVersion version)
VersionedPersistentStore
contains
in interface VersionedPersistentStore<V>
key
- lookup keyversion
- version holderpublic V get(String key)
PersistentStore
get
in interface PersistentStore<V>
key
- lookup keypublic V get(String key, DataChangeVersion version)
VersionedPersistentStore
get
in interface VersionedPersistentStore<V>
key
- lookup keyversion
- version holderpublic V get(String key, boolean consistencyFlag, DataChangeVersion version)
public void put(String key, V value)
PersistentStore
mode
.put
in interface PersistentStore<V>
key
- lookup keyvalue
- value to storepublic void put(String key, V value, DataChangeVersion version)
VersionedPersistentStore
VersionMismatchException
Lifetime of the tuple depends upon store mode
.put
in interface VersionedPersistentStore<V>
key
- lookup keyvalue
- value to storeversion
- version holderpublic boolean putIfAbsent(String key, V value)
Store
putIfAbsent
in interface Store<V>
key
- lookup keyvalue
- value to storepublic void delete(String key)
Store
public Iterator<Map.Entry<String,V>> getRange(int skip, int take)
Store
public void close()
close
in interface AutoCloseable
Copyright © 1970 The Apache Software Foundation. All rights reserved.