| Constructor and Description |
|---|
DefaultDatabase(net.kuujo.copycat.resource.internal.ResourceContext context) |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Boolean> |
atomicBatchUpdate(List<org.onosproject.store.service.UpdateOperation<String,byte[]>> updates)
Perform a atomic batch update operation i.e.
|
protected <T> CompletableFuture<T> |
checkOpen(java.util.function.Supplier<CompletableFuture<T>> supplier)
If the database is closed, returning a failed CompletableFuture.
|
CompletableFuture<Void> |
clear(String tableName)
Clears the table.
|
CompletableFuture<Void> |
close() |
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<Set<Map.Entry<String,org.onosproject.store.service.Versioned<byte[]>>>> |
entrySet(String tableName)
Gets a set of entries in the table.
|
CompletableFuture<org.onosproject.store.service.Versioned<byte[]>> |
get(String tableName,
String key)
Gets a value from the table.
|
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<org.onosproject.store.service.Versioned<byte[]>> |
put(String tableName,
String key,
byte[] value)
Puts a value in the table.
|
CompletableFuture<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<org.onosproject.store.service.Versioned<byte[]>> |
remove(String tableName,
String key)
Removes a value from the table.
|
CompletableFuture<Boolean> |
remove(String tableName,
String key,
byte[] value)
Removes a key and if the existing value for that key matches the specified value.
|
CompletableFuture<Boolean> |
remove(String tableName,
String key,
long version)
Removes a key and if the existing version for that key matches the specified version.
|
CompletableFuture<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<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<Integer> |
size(String tableName)
Gets the table size.
|
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, runStartupTasksclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, create, createpublic DefaultDatabase(net.kuujo.copycat.resource.internal.ResourceContext 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<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<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<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<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<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<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<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<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<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<Boolean> atomicBatchUpdate(List<org.onosproject.store.service.UpdateOperation<String,byte[]>> updates)
DatabaseProxyatomicBatchUpdate in interface DatabaseProxy<String,byte[]>updates - list of updates to apply atomically.public 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.