Committed by
Gerrit Code Review
Correct indent
2 spaces and 4 spaces were mixed up, then changes to 4 spaces. Change-Id: I4e41189a97604a75e783d3b948d2693c257a21f4
Showing
1 changed file
with
201 additions
and
199 deletions
| ... | @@ -31,213 +31,215 @@ public interface DatabaseProxy<K, V> { | ... | @@ -31,213 +31,215 @@ public interface DatabaseProxy<K, V> { |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | * Returns a set of all tables names. | 33 | * Returns a set of all tables names. |
| 34 | + * | ||
| 34 | * @return A completable future to be completed with the result once complete. | 35 | * @return A completable future to be completed with the result once complete. |
| 35 | */ | 36 | */ |
| 36 | CompletableFuture<Set<String>> tableNames(); | 37 | CompletableFuture<Set<String>> tableNames(); |
| 37 | 38 | ||
| 38 | /** | 39 | /** |
| 39 | * Returns a mapping from counter name to next value. | 40 | * Returns a mapping from counter name to next value. |
| 41 | + * | ||
| 40 | * @return A completable future to be completed with the result once complete. | 42 | * @return A completable future to be completed with the result once complete. |
| 41 | */ | 43 | */ |
| 42 | CompletableFuture<Map<String, Long>> counters(); | 44 | CompletableFuture<Map<String, Long>> counters(); |
| 43 | 45 | ||
| 44 | - /** | 46 | + /** |
| 45 | - * Gets the table size. | 47 | + * Gets the table size. |
| 46 | - * | 48 | + * |
| 47 | - * @param tableName table name | 49 | + * @param tableName table name |
| 48 | - * @return A completable future to be completed with the result once complete. | 50 | + * @return A completable future to be completed with the result once complete. |
| 49 | - */ | 51 | + */ |
| 50 | - CompletableFuture<Integer> size(String tableName); | 52 | + CompletableFuture<Integer> size(String tableName); |
| 51 | - | 53 | + |
| 52 | - /** | 54 | + /** |
| 53 | - * Checks whether the table is empty. | 55 | + * Checks whether the table is empty. |
| 54 | - * | 56 | + * |
| 55 | - * @param tableName table name | 57 | + * @param tableName table name |
| 56 | - * @return A completable future to be completed with the result once complete. | 58 | + * @return A completable future to be completed with the result once complete. |
| 57 | - */ | 59 | + */ |
| 58 | - CompletableFuture<Boolean> isEmpty(String tableName); | 60 | + CompletableFuture<Boolean> isEmpty(String tableName); |
| 59 | - | 61 | + |
| 60 | - /** | 62 | + /** |
| 61 | - * Checks whether the table contains a key. | 63 | + * Checks whether the table contains a key. |
| 62 | - * | 64 | + * |
| 63 | - * @param tableName table name | 65 | + * @param tableName table name |
| 64 | - * @param key The key to check. | 66 | + * @param key The key to check. |
| 65 | - * @return A completable future to be completed with the result once complete. | 67 | + * @return A completable future to be completed with the result once complete. |
| 66 | - */ | 68 | + */ |
| 67 | - CompletableFuture<Boolean> containsKey(String tableName, K key); | 69 | + CompletableFuture<Boolean> containsKey(String tableName, K key); |
| 68 | - | 70 | + |
| 69 | - /** | 71 | + /** |
| 70 | - * Checks whether the table contains a value. | 72 | + * Checks whether the table contains a value. |
| 71 | - * | 73 | + * |
| 72 | - * @param tableName table name | 74 | + * @param tableName table name |
| 73 | - * @param value The value to check. | 75 | + * @param value The value to check. |
| 74 | - * @return A completable future to be completed with the result once complete. | 76 | + * @return A completable future to be completed with the result once complete. |
| 75 | - */ | 77 | + */ |
| 76 | - CompletableFuture<Boolean> containsValue(String tableName, V value); | 78 | + CompletableFuture<Boolean> containsValue(String tableName, V value); |
| 77 | - | 79 | + |
| 78 | - /** | 80 | + /** |
| 79 | - * Gets a value from the table. | 81 | + * Gets a value from the table. |
| 80 | - * | 82 | + * |
| 81 | - * @param tableName table name | 83 | + * @param tableName table name |
| 82 | - * @param key The key to get. | 84 | + * @param key The key to get. |
| 83 | - * @return A completable future to be completed with the result once complete. | 85 | + * @return A completable future to be completed with the result once complete. |
| 84 | - */ | 86 | + */ |
| 85 | - CompletableFuture<Versioned<V>> get(String tableName, K key); | 87 | + CompletableFuture<Versioned<V>> get(String tableName, K key); |
| 86 | - | 88 | + |
| 87 | - /** | 89 | + /** |
| 88 | - * Puts a value in the table. | 90 | + * Puts a value in the table. |
| 89 | - * | 91 | + * |
| 90 | - * @param tableName table name | 92 | + * @param tableName table name |
| 91 | - * @param key The key to set. | 93 | + * @param key The key to set. |
| 92 | - * @param value The value to set. | 94 | + * @param value The value to set. |
| 93 | - * @return A completable future to be completed with the result once complete. | 95 | + * @return A completable future to be completed with the result once complete. |
| 94 | - */ | 96 | + */ |
| 95 | - CompletableFuture<Result<Versioned<V>>> put(String tableName, K key, V value); | 97 | + CompletableFuture<Result<Versioned<V>>> put(String tableName, K key, V value); |
| 96 | - | 98 | + |
| 97 | - /** | 99 | + /** |
| 98 | - * Removes a value from the table. | 100 | + * Removes a value from the table. |
| 99 | - * | 101 | + * |
| 100 | - * @param tableName table name | 102 | + * @param tableName table name |
| 101 | - * @param key The key to remove. | 103 | + * @param key The key to remove. |
| 102 | - * @return A completable future to be completed with the result once complete. | 104 | + * @return A completable future to be completed with the result once complete. |
| 103 | - */ | 105 | + */ |
| 104 | - CompletableFuture<Result<Versioned<V>>> remove(String tableName, K key); | 106 | + CompletableFuture<Result<Versioned<V>>> remove(String tableName, K key); |
| 105 | - | 107 | + |
| 106 | - /** | 108 | + /** |
| 107 | - * Clears the table. | 109 | + * Clears the table. |
| 108 | - * | 110 | + * |
| 109 | - * @param tableName table name | 111 | + * @param tableName table name |
| 110 | - * @return A completable future to be completed with the result once complete. | 112 | + * @return A completable future to be completed with the result once complete. |
| 111 | - */ | 113 | + */ |
| 112 | - CompletableFuture<Result<Void>> clear(String tableName); | 114 | + CompletableFuture<Result<Void>> clear(String tableName); |
| 113 | - | 115 | + |
| 114 | - /** | 116 | + /** |
| 115 | - * Gets a set of keys in the table. | 117 | + * Gets a set of keys in the table. |
| 116 | - * | 118 | + * |
| 117 | - * @param tableName table name | 119 | + * @param tableName table name |
| 118 | - * @return A completable future to be completed with the result once complete. | 120 | + * @return A completable future to be completed with the result once complete. |
| 119 | - */ | 121 | + */ |
| 120 | - CompletableFuture<Set<K>> keySet(String tableName); | 122 | + CompletableFuture<Set<K>> keySet(String tableName); |
| 121 | - | 123 | + |
| 122 | - /** | 124 | + /** |
| 123 | - * Gets a collection of values in the table. | 125 | + * Gets a collection of values in the table. |
| 124 | - * | 126 | + * |
| 125 | - * @param tableName table name | 127 | + * @param tableName table name |
| 126 | - * @return A completable future to be completed with the result once complete. | 128 | + * @return A completable future to be completed with the result once complete. |
| 127 | - */ | 129 | + */ |
| 128 | - CompletableFuture<Collection<Versioned<V>>> values(String tableName); | 130 | + CompletableFuture<Collection<Versioned<V>>> values(String tableName); |
| 129 | - | 131 | + |
| 130 | - /** | 132 | + /** |
| 131 | - * Gets a set of entries in the table. | 133 | + * Gets a set of entries in the table. |
| 132 | - * | 134 | + * |
| 133 | - * @param tableName table name | 135 | + * @param tableName table name |
| 134 | - * @return A completable future to be completed with the result once complete. | 136 | + * @return A completable future to be completed with the result once complete. |
| 135 | - */ | 137 | + */ |
| 136 | - CompletableFuture<Set<Map.Entry<K, Versioned<V>>>> entrySet(String tableName); | 138 | + CompletableFuture<Set<Map.Entry<K, Versioned<V>>>> entrySet(String tableName); |
| 137 | - | 139 | + |
| 138 | - /** | 140 | + /** |
| 139 | - * Puts a value in the table if the given key does not exist. | 141 | + * Puts a value in the table if the given key does not exist. |
| 140 | - * | 142 | + * |
| 141 | - * @param tableName table name | 143 | + * @param tableName table name |
| 142 | - * @param key The key to set. | 144 | + * @param key The key to set. |
| 143 | - * @param value The value to set if the given key does not exist. | 145 | + * @param value The value to set if the given key does not exist. |
| 144 | - * @return A completable future to be completed with the result once complete. | 146 | + * @return A completable future to be completed with the result once complete. |
| 145 | - */ | 147 | + */ |
| 146 | - CompletableFuture<Result<Versioned<V>>> putIfAbsent(String tableName, K key, V value); | 148 | + CompletableFuture<Result<Versioned<V>>> putIfAbsent(String tableName, K key, V value); |
| 147 | - | 149 | + |
| 148 | - /** | 150 | + /** |
| 149 | - * Removes a key and if the existing value for that key matches the specified value. | 151 | + * Removes a key and if the existing value for that key matches the specified value. |
| 150 | - * | 152 | + * |
| 151 | - * @param tableName table name | 153 | + * @param tableName table name |
| 152 | - * @param key The key to remove. | 154 | + * @param key The key to remove. |
| 153 | - * @param value The value to remove. | 155 | + * @param value The value to remove. |
| 154 | - * @return A completable future to be completed with the result once complete. | 156 | + * @return A completable future to be completed with the result once complete. |
| 155 | - */ | 157 | + */ |
| 156 | - CompletableFuture<Result<Boolean>> remove(String tableName, K key, V value); | 158 | + CompletableFuture<Result<Boolean>> remove(String tableName, K key, V value); |
| 157 | - | 159 | + |
| 158 | - /** | 160 | + /** |
| 159 | - * Removes a key and if the existing version for that key matches the specified version. | 161 | + * Removes a key and if the existing version for that key matches the specified version. |
| 160 | - * | 162 | + * |
| 161 | - * @param tableName table name | 163 | + * @param tableName table name |
| 162 | - * @param key The key to remove. | 164 | + * @param key The key to remove. |
| 163 | - * @param version The expected version. | 165 | + * @param version The expected version. |
| 164 | - * @return A completable future to be completed with the result once complete. | 166 | + * @return A completable future to be completed with the result once complete. |
| 165 | - */ | 167 | + */ |
| 166 | - CompletableFuture<Result<Boolean>> remove(String tableName, K key, long version); | 168 | + CompletableFuture<Result<Boolean>> remove(String tableName, K key, long version); |
| 167 | - | 169 | + |
| 168 | - /** | 170 | + /** |
| 169 | - * Replaces the entry for the specified key only if currently mapped to the specified value. | 171 | + * Replaces the entry for the specified key only if currently mapped to the specified value. |
| 170 | - * | 172 | + * |
| 171 | - * @param tableName table name | 173 | + * @param tableName table name |
| 172 | - * @param key The key to replace. | 174 | + * @param key The key to replace. |
| 173 | - * @param oldValue The value to replace. | 175 | + * @param oldValue The value to replace. |
| 174 | - * @param newValue The value with which to replace the given key and value. | 176 | + * @param newValue The value with which to replace the given key and value. |
| 175 | - * @return A completable future to be completed with the result once complete. | 177 | + * @return A completable future to be completed with the result once complete. |
| 176 | - */ | 178 | + */ |
| 177 | - CompletableFuture<Result<Boolean>> replace(String tableName, K key, V oldValue, V newValue); | 179 | + CompletableFuture<Result<Boolean>> replace(String tableName, K key, V oldValue, V newValue); |
| 178 | - | 180 | + |
| 179 | - /** | 181 | + /** |
| 180 | - * Replaces the entry for the specified key only if currently mapped to the specified version. | 182 | + * Replaces the entry for the specified key only if currently mapped to the specified version. |
| 181 | - * | 183 | + * |
| 182 | - * @param tableName table name | 184 | + * @param tableName table name |
| 183 | - * @param key The key to update | 185 | + * @param key The key to update |
| 184 | - * @param oldVersion existing version in the map for this replace to succeed. | 186 | + * @param oldVersion existing version in the map for this replace to succeed. |
| 185 | - * @param newValue The value with which to replace the given key and version. | 187 | + * @param newValue The value with which to replace the given key and version. |
| 186 | - * @return A completable future to be completed with the result once complete. | 188 | + * @return A completable future to be completed with the result once complete. |
| 187 | - */ | 189 | + */ |
| 188 | - CompletableFuture<Result<Boolean>> replace(String tableName, K key, long oldVersion, V newValue); | 190 | + CompletableFuture<Result<Boolean>> replace(String tableName, K key, long oldVersion, V newValue); |
| 189 | - | 191 | + |
| 190 | - /** | 192 | + /** |
| 191 | - * Returns the next value for the specified atomic counter after | 193 | + * Returns the next value for the specified atomic counter after |
| 192 | - * incrementing the current value by one. | 194 | + * incrementing the current value by one. |
| 193 | - * | 195 | + * |
| 194 | - * @param counterName counter name | 196 | + * @param counterName counter name |
| 195 | - * @return next value for the specified counter | 197 | + * @return next value for the specified counter |
| 196 | - */ | 198 | + */ |
| 197 | - CompletableFuture<Long> nextValue(String counterName); | 199 | + CompletableFuture<Long> nextValue(String counterName); |
| 198 | - | 200 | + |
| 199 | - /** | 201 | + /** |
| 200 | - * Returns the current value for the specified atomic counter. | 202 | + * Returns the current value for the specified atomic counter. |
| 201 | - * | 203 | + * |
| 202 | - * @param counterName counter name | 204 | + * @param counterName counter name |
| 203 | - * @return current value for the specified counter | 205 | + * @return current value for the specified counter |
| 204 | - */ | 206 | + */ |
| 205 | - CompletableFuture<Long> currentValue(String counterName); | 207 | + CompletableFuture<Long> currentValue(String counterName); |
| 206 | - | 208 | + |
| 207 | - /** | 209 | + /** |
| 208 | - * Prepare and commit the specified transaction. | 210 | + * Prepare and commit the specified transaction. |
| 209 | - * | 211 | + * |
| 210 | - * @param transaction transaction to commit (after preparation) | 212 | + * @param transaction transaction to commit (after preparation) |
| 211 | - * @return A completable future to be completed with the result once complete | 213 | + * @return A completable future to be completed with the result once complete |
| 212 | - */ | 214 | + */ |
| 213 | - CompletableFuture<Boolean> prepareAndCommit(Transaction transaction); | 215 | + CompletableFuture<Boolean> prepareAndCommit(Transaction transaction); |
| 214 | - | 216 | + |
| 215 | - /** | 217 | + /** |
| 216 | - * Prepare the specified transaction for commit. A successful prepare implies | 218 | + * Prepare the specified transaction for commit. A successful prepare implies |
| 217 | - * all the affected resources are locked thus ensuring no concurrent updates can interfere. | 219 | + * all the affected resources are locked thus ensuring no concurrent updates can interfere. |
| 218 | - * | 220 | + * |
| 219 | - * @param transaction transaction to prepare (for commit) | 221 | + * @param transaction transaction to prepare (for commit) |
| 220 | - * @return A completable future to be completed with the result once complete. The future is completed | 222 | + * @return A completable future to be completed with the result once complete. The future is completed |
| 221 | - * with true if the transaction is successfully prepared i.e. all pre-conditions are met and | 223 | + * with true if the transaction is successfully prepared i.e. all pre-conditions are met and |
| 222 | - * applicable resources locked. | 224 | + * applicable resources locked. |
| 223 | - */ | 225 | + */ |
| 224 | - CompletableFuture<Boolean> prepare(Transaction transaction); | 226 | + CompletableFuture<Boolean> prepare(Transaction transaction); |
| 225 | - | 227 | + |
| 226 | - /** | 228 | + /** |
| 227 | - * Commit the specified transaction. A successful commit implies | 229 | + * Commit the specified transaction. A successful commit implies |
| 228 | - * all the updates are applied, are now durable and are now visible externally. | 230 | + * all the updates are applied, are now durable and are now visible externally. |
| 229 | - * | 231 | + * |
| 230 | - * @param transaction transaction to commit | 232 | + * @param transaction transaction to commit |
| 231 | - * @return A completable future to be completed with the result once complete | 233 | + * @return A completable future to be completed with the result once complete |
| 232 | - */ | 234 | + */ |
| 233 | - CompletableFuture<Boolean> commit(Transaction transaction); | 235 | + CompletableFuture<Boolean> commit(Transaction transaction); |
| 234 | - | 236 | + |
| 235 | - /** | 237 | + /** |
| 236 | - * Rollback the specified transaction. A successful rollback implies | 238 | + * Rollback the specified transaction. A successful rollback implies |
| 237 | - * all previously acquired locks for the affected resources are released. | 239 | + * all previously acquired locks for the affected resources are released. |
| 238 | - * | 240 | + * |
| 239 | - * @param transaction transaction to rollback | 241 | + * @param transaction transaction to rollback |
| 240 | - * @return A completable future to be completed with the result once complete | 242 | + * @return A completable future to be completed with the result once complete |
| 241 | - */ | 243 | + */ |
| 242 | - CompletableFuture<Boolean> rollback(Transaction transaction); | 244 | + CompletableFuture<Boolean> rollback(Transaction transaction); |
| 243 | } | 245 | } | ... | ... |
-
Please register or login to post a comment