| Constructor and Description |
|---|
DefaultDatabase(net.kuujo.copycat.resource.internal.ResourceManager context) |
| Modifier and Type | Method and Description |
|---|---|
protected <T> CompletableFuture<T> |
checkOpen(java.util.function.Supplier<CompletableFuture<T>> supplier)
If the database is closed, returning a failed CompletableFuture.
|
CompletableFuture<Result<Void>> |
clear(String tableName)
Clears the table.
|
CompletableFuture<Void> |
close() |
CompletableFuture<Boolean> |
commit(org.onosproject.store.service.Transaction transaction)
Commit the specified transaction.
|
CompletableFuture<Boolean> |
containsKey(String tableName,
String key)
Checks whether the table contains a key.
|
CompletableFuture<Boolean> |
containsValue(String tableName,
byte[] value)
Checks whether the table contains a value.
|
CompletableFuture<Long> |
counterAddAndGet(String counterName,
long delta)
Atomically add the given value to current value of the specified counter.
|
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<Set<Map.Entry<String,org.onosproject.store.service.Versioned<byte[]>>>> |
entrySet(String tableName)
Gets a set of entries in the table.
|
boolean |
equals(Object other) |
CompletableFuture<org.onosproject.store.service.Versioned<byte[]>> |
get(String tableName,
String key)
Gets a value from the table.
|
int |
hashCode() |
CompletableFuture<Boolean> |
isEmpty(String tableName)
Checks whether the table is empty.
|
CompletableFuture<Set<String>> |
keySet(String tableName)
Gets a set of keys in the table.
|
CompletableFuture<Database> |
open() |
CompletableFuture<Boolean> |
prepare(org.onosproject.store.service.Transaction transaction)
Prepare the specified transaction for commit.
|
CompletableFuture<Boolean> |
prepareAndCommit(org.onosproject.store.service.Transaction transaction)
Prepare and commit the specified transaction.
|
CompletableFuture<Result<org.onosproject.store.service.Versioned<byte[]>>> |
put(String tableName,
String key,
byte[] value)
Puts a value in the table.
|
CompletableFuture<Result<UpdateResult<org.onosproject.store.service.Versioned<byte[]>>>> |
putAndGet(String tableName,
String key,
byte[] value)
Puts a value in the table.
|
CompletableFuture<Result<org.onosproject.store.service.Versioned<byte[]>>> |
putIfAbsent(String tableName,
String key,
byte[] value)
Puts a value in the table if the given key does not exist.
|
CompletableFuture<Result<UpdateResult<org.onosproject.store.service.Versioned<byte[]>>>> |
putIfAbsentAndGet(String tableName,
String key,
byte[] value)
Puts a value in the table.
|
CompletableFuture<Result<org.onosproject.store.service.Versioned<byte[]>>> |
remove(String tableName,
String key)
Removes a value from the table.
|
CompletableFuture<Result<Boolean>> |
remove(String tableName,
String key,
byte[] value)
Removes a key and if the existing value for that key matches the specified value.
|
CompletableFuture<Result<Boolean>> |
remove(String tableName,
String key,
long version)
Removes a key and if the existing version for that key matches the specified version.
|
CompletableFuture<Result<Boolean>> |
replace(String tableName,
String key,
byte[] oldValue,
byte[] newValue)
Replaces the entry for the specified key only if currently mapped to the specified value.
|
CompletableFuture<Result<Boolean>> |
replace(String tableName,
String key,
long oldVersion,
byte[] newValue)
Replaces the entry for the specified key only if currently mapped to the specified version.
|
CompletableFuture<Result<UpdateResult<org.onosproject.store.service.Versioned<byte[]>>>> |
replaceAndGet(String tableName,
String key,
long oldVersion,
byte[] newValue)
Replaces the entry for the specified key only if currently mapped to the specified version.
|
CompletableFuture<Boolean> |
rollback(org.onosproject.store.service.Transaction transaction)
Rollback the specified transaction.
|
CompletableFuture<Integer> |
size(String tableName)
Gets the table size.
|
CompletableFuture<Set<String>> |
tableNames()
Returns a set of all tables names.
|
CompletableFuture<Collection<org.onosproject.store.service.Versioned<byte[]>>> |
values(String tableName)
Gets a collection of values in the table.
|
addShutdownTask, addStartupTask, cluster, isClosed, isOpen, name, runShutdownTasks, runStartupTasks, stateclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcreate, create, createpublic DefaultDatabase(net.kuujo.copycat.resource.internal.ResourceManager context)
protected <T> CompletableFuture<T> checkOpen(java.util.function.Supplier<CompletableFuture<T>> supplier)
T - The future result type.supplier - The supplier to call if the database is open.public CompletableFuture<Set<String>> tableNames()
DatabaseProxytableNames in interface DatabaseProxy<String,byte[]>public CompletableFuture<Map<String,Long>> counters()
DatabaseProxycounters in interface DatabaseProxy<String,byte[]>public CompletableFuture<Integer> size(String tableName)
DatabaseProxysize in interface DatabaseProxy<String,byte[]>tableName - table namepublic CompletableFuture<Boolean> isEmpty(String tableName)
DatabaseProxyisEmpty in interface DatabaseProxy<String,byte[]>tableName - table namepublic CompletableFuture<Boolean> containsKey(String tableName, String key)
DatabaseProxycontainsKey in interface DatabaseProxy<String,byte[]>tableName - table namekey - The key to check.public CompletableFuture<Boolean> containsValue(String tableName, byte[] value)
DatabaseProxycontainsValue in interface DatabaseProxy<String,byte[]>tableName - table namevalue - The value to check.public CompletableFuture<org.onosproject.store.service.Versioned<byte[]>> get(String tableName, String key)
DatabaseProxyget in interface DatabaseProxy<String,byte[]>tableName - table namekey - The key to get.public CompletableFuture<Result<org.onosproject.store.service.Versioned<byte[]>>> put(String tableName, String key, byte[] value)
DatabaseProxyput in interface DatabaseProxy<String,byte[]>tableName - table namekey - The key to set.value - The value to set.public CompletableFuture<Result<UpdateResult<org.onosproject.store.service.Versioned<byte[]>>>> putAndGet(String tableName, String key, byte[] value)
DatabaseProxyputAndGet in interface DatabaseProxy<String,byte[]>tableName - table namekey - The key to set.value - The value to set.public CompletableFuture<Result<UpdateResult<org.onosproject.store.service.Versioned<byte[]>>>> putIfAbsentAndGet(String tableName, String key, byte[] value)
DatabaseProxyputIfAbsentAndGet in interface DatabaseProxy<String,byte[]>tableName - table namekey - The key to set.value - The value to set.public CompletableFuture<Result<org.onosproject.store.service.Versioned<byte[]>>> remove(String tableName, String key)
DatabaseProxyremove in interface DatabaseProxy<String,byte[]>tableName - table namekey - The key to remove.public CompletableFuture<Result<Void>> clear(String tableName)
DatabaseProxyclear in interface DatabaseProxy<String,byte[]>tableName - table namepublic CompletableFuture<Set<String>> keySet(String tableName)
DatabaseProxykeySet in interface DatabaseProxy<String,byte[]>tableName - table namepublic CompletableFuture<Collection<org.onosproject.store.service.Versioned<byte[]>>> values(String tableName)
DatabaseProxyvalues in interface DatabaseProxy<String,byte[]>tableName - table namepublic CompletableFuture<Set<Map.Entry<String,org.onosproject.store.service.Versioned<byte[]>>>> entrySet(String tableName)
DatabaseProxyentrySet in interface DatabaseProxy<String,byte[]>tableName - table namepublic CompletableFuture<Result<org.onosproject.store.service.Versioned<byte[]>>> putIfAbsent(String tableName, String key, byte[] value)
DatabaseProxyputIfAbsent in interface DatabaseProxy<String,byte[]>tableName - table namekey - The key to set.value - The value to set if the given key does not exist.public CompletableFuture<Result<Boolean>> remove(String tableName, String key, byte[] value)
DatabaseProxyremove in interface DatabaseProxy<String,byte[]>tableName - table namekey - The key to remove.value - The value to remove.public CompletableFuture<Result<Boolean>> remove(String tableName, String key, long version)
DatabaseProxyremove in interface DatabaseProxy<String,byte[]>tableName - table namekey - The key to remove.version - The expected version.public CompletableFuture<Result<Boolean>> replace(String tableName, String key, byte[] oldValue, byte[] newValue)
DatabaseProxyreplace in interface DatabaseProxy<String,byte[]>tableName - table namekey - The key to replace.oldValue - The value to replace.newValue - The value with which to replace the given key and value.public CompletableFuture<Result<Boolean>> replace(String tableName, String key, long oldVersion, byte[] newValue)
DatabaseProxyreplace in interface DatabaseProxy<String,byte[]>tableName - table namekey - The key to updateoldVersion - existing version in the map for this replace to succeed.newValue - The value with which to replace the given key and version.public CompletableFuture<Result<UpdateResult<org.onosproject.store.service.Versioned<byte[]>>>> replaceAndGet(String tableName, String key, long oldVersion, byte[] newValue)
DatabaseProxyreplaceAndGet in interface DatabaseProxy<String,byte[]>tableName - table namekey - The key to updateoldVersion - existing version in the map for this replace to succeed.newValue - The value with which to replace the given key and version.public 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<Boolean> 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<Boolean> 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>Copyright © 2015. All rights reserved.