public class PartitionedDatabase extends Object implements DatabaseProxy<String,byte[]>, PartitionedDatabaseManager
| Modifier | Constructor and Description |
|---|---|
protected |
PartitionedDatabase(net.kuujo.copycat.cluster.internal.coordinator.ClusterCoordinator coordinator) |
| 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.
|
CompletableFuture<Void> |
clear(String tableName)
Clears the table.
|
CompletableFuture<Void> |
close()
Closes the database.
|
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.
|
Map<String,Database> |
getRegisteredPartitions()
Returns all the registered database partitions.
|
CompletableFuture<Boolean> |
isEmpty(String tableName)
Checks whether the table is empty.
|
boolean |
isOpen()
Returns true if the database is open.
|
CompletableFuture<Set<String>> |
keySet(String tableName)
Gets a set of keys in the table.
|
CompletableFuture<PartitionedDatabase> |
open()
Opens the database.
|
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.
|
void |
registerPartition(String name,
Database partition)
Registers a new partition.
|
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.
|
void |
setPartitioner(Partitioner<String> partitioner)
Sets the partitioner to use for mapping keys to partitions.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateprotected PartitionedDatabase(net.kuujo.copycat.cluster.internal.coordinator.ClusterCoordinator coordinator)
public boolean isOpen()
public void registerPartition(String name, Database partition)
PartitionedDatabaseManagerregisterPartition in interface PartitionedDatabaseManagername - partition name.partition - partition.public Map<String,Database> getRegisteredPartitions()
PartitionedDatabaseManagergetRegisteredPartitions in interface PartitionedDatabaseManagerpublic 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 void setPartitioner(Partitioner<String> partitioner)
PartitionedDatabaseManagersetPartitioner in interface PartitionedDatabaseManagerpartitioner - partitionerpublic CompletableFuture<PartitionedDatabase> open()
PartitionedDatabaseManageropen in interface PartitionedDatabaseManagerpublic CompletableFuture<Void> close()
PartitionedDatabaseManagerclose in interface PartitionedDatabaseManagerCopyright © 2015. All rights reserved.