| Constructor and Description |
|---|
DefaultDatabase(net.kuujo.copycat.resource.internal.ResourceManager context) |
| Modifier and Type | Method and Description |
|---|---|
protected <T> CompletableFuture<T> |
checkOpen(Supplier<CompletableFuture<T>> supplier)
If the database is closed, returning a failed CompletableFuture.
|
CompletableFuture<Void> |
close() |
CompletableFuture<CommitResponse> |
commit(org.onosproject.store.service.Transaction transaction)
Commit the specified transaction.
|
CompletableFuture<Long> |
counterAddAndGet(String counterName,
long delta)
Atomically add the given value to current value of the specified counter.
|
CompletableFuture<Boolean> |
counterCompareAndSet(String counterName,
long expectedValue,
long update)
Atomically sets the given counter to the specified update value if and only if the current value is equal to the
expected value.
|
CompletableFuture<Long> |
counterGet(String counterName)
Returns the current value of the specified atomic counter.
|
CompletableFuture<Long> |
counterGetAndAdd(String counterName,
long delta)
Atomically add the given value to current value of the specified counter.
|
CompletableFuture<Map<String,Long>> |
counters()
Returns a mapping from counter name to next value.
|
CompletableFuture<Void> |
counterSet(String counterName,
long value)
Atomically sets the given value to current value of the specified counter.
|
boolean |
equals(Object other) |
int |
hashCode() |
CompletableFuture<Result<Void>> |
mapClear(String mapName)
Clears the map.
|
CompletableFuture<Boolean> |
mapContainsKey(String mapName,
String key)
Checks whether the map contains a key.
|
CompletableFuture<Boolean> |
mapContainsValue(String mapName,
byte[] value)
Checks whether the map contains a value.
|
CompletableFuture<Set<Map.Entry<String,org.onosproject.store.service.Versioned<byte[]>>>> |
mapEntrySet(String mapName)
Gets a set of entries in the map.
|
CompletableFuture<org.onosproject.store.service.Versioned<byte[]>> |
mapGet(String mapName,
String key)
Gets a value from the map.
|
CompletableFuture<Boolean> |
mapIsEmpty(String mapName)
Checks whether the map is empty.
|
CompletableFuture<Set<String>> |
mapKeySet(String mapName)
Gets a set of keys in the map.
|
CompletableFuture<Set<String>> |
maps()
Returns a set of all map names.
|
CompletableFuture<Integer> |
mapSize(String mapName)
Returns the number of entries in map.
|
CompletableFuture<Result<UpdateResult<String,byte[]>>> |
mapUpdate(String mapName,
String key,
Match<byte[]> valueMatch,
Match<Long> versionMatch,
byte[] value)
Updates the map.
|
CompletableFuture<Collection<org.onosproject.store.service.Versioned<byte[]>>> |
mapValues(String mapName)
Gets a collection of values in the map.
|
CompletableFuture<Database> |
open() |
CompletableFuture<Boolean> |
prepare(org.onosproject.store.service.Transaction transaction)
Prepare the specified transaction for commit.
|
CompletableFuture<CommitResponse> |
prepareAndCommit(org.onosproject.store.service.Transaction transaction)
Prepare and commit the specified transaction.
|
CompletableFuture<byte[]> |
queuePeek(String queueName)
Returns but does not remove an entry from the queue.
|
CompletableFuture<byte[]> |
queuePop(String queueName)
Removes an entry from the queue if the queue is non-empty.
|
CompletableFuture<Void> |
queuePush(String queueName,
byte[] entry)
Inserts an entry into the queue.
|
CompletableFuture<Long> |
queueSize(String queueName)
Returns the size of queue.
|
void |
registerConsumer(Consumer<StateMachineUpdate> consumer)
Registers a new consumer of StateMachineUpdates.
|
CompletableFuture<Boolean> |
rollback(org.onosproject.store.service.Transaction transaction)
Rollback the specified transaction.
|
void |
unregisterConsumer(Consumer<StateMachineUpdate> consumer)
Unregisters a consumer of StateMachineUpdates.
|
addShutdownTask, addStartupTask, cluster, isClosed, isOpen, name, runShutdownTasks, runStartupTasks, stateclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcreate, create, create, hasChangeNotificationSupportpublic DefaultDatabase(net.kuujo.copycat.resource.internal.ResourceManager context)
protected <T> CompletableFuture<T> checkOpen(Supplier<CompletableFuture<T>> supplier)
T - The future result type.supplier - The supplier to call if the database is open.public CompletableFuture<Set<String>> maps()
DatabaseProxymaps in interface DatabaseProxy<String,byte[]>public CompletableFuture<Map<String,Long>> counters()
DatabaseProxycounters in interface DatabaseProxy<String,byte[]>public CompletableFuture<Integer> mapSize(String mapName)
DatabaseProxymapSize in interface DatabaseProxy<String,byte[]>mapName - map namepublic CompletableFuture<Boolean> mapIsEmpty(String mapName)
DatabaseProxymapIsEmpty in interface DatabaseProxy<String,byte[]>mapName - map namepublic CompletableFuture<Boolean> mapContainsKey(String mapName, String key)
DatabaseProxymapContainsKey in interface DatabaseProxy<String,byte[]>mapName - map namekey - key to check.public CompletableFuture<Boolean> mapContainsValue(String mapName, byte[] value)
DatabaseProxymapContainsValue in interface DatabaseProxy<String,byte[]>mapName - map namevalue - The value to check.public CompletableFuture<org.onosproject.store.service.Versioned<byte[]>> mapGet(String mapName, String key)
DatabaseProxymapGet in interface DatabaseProxy<String,byte[]>mapName - map namekey - The key to get.public CompletableFuture<Result<UpdateResult<String,byte[]>>> mapUpdate(String mapName, String key, Match<byte[]> valueMatch, Match<Long> versionMatch, byte[] value)
DatabaseProxymapUpdate in interface DatabaseProxy<String,byte[]>mapName - map namekey - The key to setvalueMatch - match for checking existing valueversionMatch - match for checking existing versionvalue - new valuepublic CompletableFuture<Result<Void>> mapClear(String mapName)
DatabaseProxymapClear in interface DatabaseProxy<String,byte[]>mapName - map namepublic CompletableFuture<Set<String>> mapKeySet(String mapName)
DatabaseProxymapKeySet in interface DatabaseProxy<String,byte[]>mapName - map namepublic CompletableFuture<Collection<org.onosproject.store.service.Versioned<byte[]>>> mapValues(String mapName)
DatabaseProxymapValues in interface DatabaseProxy<String,byte[]>mapName - map namepublic CompletableFuture<Set<Map.Entry<String,org.onosproject.store.service.Versioned<byte[]>>>> mapEntrySet(String mapName)
DatabaseProxymapEntrySet in interface DatabaseProxy<String,byte[]>mapName - map namepublic CompletableFuture<Long> counterGet(String counterName)
DatabaseProxycounterGet in interface DatabaseProxy<String,byte[]>counterName - counter namepublic CompletableFuture<Long> counterAddAndGet(String counterName, long delta)
DatabaseProxycounterAddAndGet in interface DatabaseProxy<String,byte[]>counterName - counter namedelta - value to addpublic CompletableFuture<Long> counterGetAndAdd(String counterName, long delta)
DatabaseProxycounterGetAndAdd in interface DatabaseProxy<String,byte[]>counterName - counter namedelta - value to addpublic CompletableFuture<Void> counterSet(String counterName, long value)
DatabaseProxycounterSet in interface DatabaseProxy<String,byte[]>counterName - counter namevalue - value to setpublic CompletableFuture<Boolean> counterCompareAndSet(String counterName, long expectedValue, long update)
DatabaseProxycounterCompareAndSet in interface DatabaseProxy<String,byte[]>counterName - counter nameexpectedValue - value to use for equivalence checkupdate - value to set if expected value is current valuepublic CompletableFuture<Long> queueSize(String queueName)
DatabaseProxyqueueSize in interface DatabaseProxy<String,byte[]>queueName - queue namepublic CompletableFuture<Void> queuePush(String queueName, byte[] entry)
DatabaseProxyqueuePush in interface DatabaseProxy<String,byte[]>queueName - queue nameentry - queue entrypublic CompletableFuture<byte[]> queuePop(String queueName)
DatabaseProxyqueuePop in interface DatabaseProxy<String,byte[]>queueName - queue namepublic CompletableFuture<byte[]> queuePeek(String queueName)
DatabaseProxyqueuePeek in interface DatabaseProxy<String,byte[]>queueName - queue namepublic CompletableFuture<CommitResponse> prepareAndCommit(org.onosproject.store.service.Transaction transaction)
DatabaseProxyprepareAndCommit in interface DatabaseProxy<String,byte[]>transaction - transaction to commit (after preparation)public CompletableFuture<Boolean> prepare(org.onosproject.store.service.Transaction transaction)
DatabaseProxyprepare in interface DatabaseProxy<String,byte[]>transaction - transaction to prepare (for commit)public CompletableFuture<CommitResponse> commit(org.onosproject.store.service.Transaction transaction)
DatabaseProxycommit in interface DatabaseProxy<String,byte[]>transaction - transaction to commitpublic CompletableFuture<Boolean> rollback(org.onosproject.store.service.Transaction transaction)
DatabaseProxyrollback in interface DatabaseProxy<String,byte[]>transaction - transaction to rollbackpublic CompletableFuture<Database> open()
open in interface net.kuujo.copycat.util.Managed<Database>public CompletableFuture<Void> close()
close in interface net.kuujo.copycat.util.Managed<Database>public void registerConsumer(Consumer<StateMachineUpdate> consumer)
DatabaseregisterConsumer in interface Databaseconsumer - consumer to registerpublic void unregisterConsumer(Consumer<StateMachineUpdate> consumer)
DatabaseunregisterConsumer in interface Databaseconsumer - consumer to unregisterCopyright © 2015. All rights reserved.