Interface ReadableDistributedMetaStorage
-
- All Known Subinterfaces:
DistributedMetaStorage
- All Known Implementing Classes:
DistributedMetaStorageImpl
public interface ReadableDistributedMetaStorageAPI for distributed data storage. Gives the ability to store configuration data (or any other data) consistently and cluster-wide. It is guaranteed that every read value is the same on every node in the cluster all the time.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetUpdatesCount()Get the total number of updates (write/remove) that metastorage ever had.voiditerate(@NotNull String keyPrefix, @NotNull BiConsumer<String,? super Serializable> cb)Iterate over all values corresponding to the keys with given prefix.voidlisten(@NotNull Predicate<String> keyPred, DistributedMetaStorageListener<?> lsnr)Add listener on data updates.<T extends Serializable>
Tread(@NotNull String key)Get value by the key.
-
-
-
Method Detail
-
getUpdatesCount
long getUpdatesCount()
Get the total number of updates (write/remove) that metastorage ever had.
-
read
@Nullable <T extends Serializable> T read(@NotNull @NotNull String key) throws IgniteCheckedException
Get value by the key. Should be consistent for all nodes.- Parameters:
key- The key.- Returns:
- Value associated with the key.
- Throws:
IgniteCheckedException- If reading or unmarshalling failed.
-
iterate
void iterate(@NotNull @NotNull String keyPrefix, @NotNull @NotNull BiConsumer<String,? super Serializable> cb) throws IgniteCheckedExceptionIterate over all values corresponding to the keys with given prefix. It is guaranteed that iteration will be executed in ascending keys order.- Parameters:
keyPrefix- Prefix for the keys that will be iterated.cb- Callback that will be applied to all<key, value>pairs.- Throws:
IgniteCheckedException- If reading or unmarshalling failed.
-
listen
void listen(@NotNull @NotNull Predicate<String> keyPred, DistributedMetaStorageListener<?> lsnr)Add listener on data updates. Updates happens it two cases:- Some node invoked write or remove. Listeners are invoked after update update operation is already completed.
- Node is just started and not ready for write yet. In this case listeners are invoked for every key with new value (retrieved from the clueter) or already existing value if there was no updates for given key. This guarantees that all listeners are invoked for all updates in case of failover.
- Parameters:
keyPred- Predicate to check whether this listener should be invoked on given key update or not.lsnr- Listener object.- See Also:
DistributedMetaStorageListener
-
-