Skip to content

Commit

Permalink
Update node-selection API for debug and lazy-free commands #145 #146
Browse files Browse the repository at this point in the history
  • Loading branch information
mp911de committed Jan 21, 2016
1 parent 71aef9e commit c4a817e
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,6 @@ public interface NodeSelectionHashAsyncCommands<K, V> {
*/
AsyncExecutions<Long> hlen(K key);

/**
* Get the string length of the field value in a hash.
*
* @param key the key
* @param field the field type: key
* @return Long integer-reply the string length of the {@code field} value, or {@code 0} when {@code field} is not present
* in the hash or {@code key} does not exist at all.
*/
AsyncExecutions<Long> hstrlen(K key, K field);

/**
* Get the values of all the given hash fields.
*
Expand Down Expand Up @@ -158,50 +148,6 @@ public interface NodeSelectionHashAsyncCommands<K, V> {
*/
AsyncExecutions<String> hmset(K key, Map<K, V> map);

/**
* Set the string value of a hash field.
*
* @param key the key
* @param field the field type: key
* @param value the value
* @return Boolean integer-reply specifically:
*
* {@literal true} if {@code field} is a new field in the hash and {@code value} was set. {@literal false} if
* {@code field} already exists in the hash and the value was updated.
*/
AsyncExecutions<Boolean> hset(K key, K field, V value);

/**
* Set the value of a hash field, only if the field does not exist.
*
* @param key the key
* @param field the field type: key
* @param value the value
* @return Boolean integer-reply specifically:
*
* {@code 1} if {@code field} is a new field in the hash and {@code value} was set. {@code 0} if {@code field}
* already exists in the hash and no operation was performed.
*/
AsyncExecutions<Boolean> hsetnx(K key, K field, V value);

/**
* Get all the values in a hash.
*
* @param key the key
* @return List&lt;V&gt; array-reply list of values in the hash, or an empty list when {@code key} does not exist.
*/
AsyncExecutions<List<V>> hvals(K key);

/**
* Stream over all the values in a hash.
*
* @param channel streaming channel that receives a call for every value
* @param key the key
*
* @return Long count of the keys.
*/
AsyncExecutions<Long> hvals(ValueStreamingChannel<V> channel, K key);

/**
* Incrementally iterate hash fields and associated values.
*
Expand Down Expand Up @@ -277,4 +223,58 @@ public interface NodeSelectionHashAsyncCommands<K, V> {
* @return StreamScanCursor scan cursor.
*/
AsyncExecutions<StreamScanCursor> hscan(KeyValueStreamingChannel<K, V> channel, K key, ScanCursor scanCursor);

/**
* Set the string value of a hash field.
*
* @param key the key
* @param field the field type: key
* @param value the value
* @return Boolean integer-reply specifically:
*
* {@literal true} if {@code field} is a new field in the hash and {@code value} was set. {@literal false} if
* {@code field} already exists in the hash and the value was updated.
*/
AsyncExecutions<Boolean> hset(K key, K field, V value);

/**
* Set the value of a hash field, only if the field does not exist.
*
* @param key the key
* @param field the field type: key
* @param value the value
* @return Boolean integer-reply specifically:
*
* {@code 1} if {@code field} is a new field in the hash and {@code value} was set. {@code 0} if {@code field}
* already exists in the hash and no operation was performed.
*/
AsyncExecutions<Boolean> hsetnx(K key, K field, V value);

/**
* Get the string length of the field value in a hash.
*
* @param key the key
* @param field the field type: key
* @return Long integer-reply the string length of the {@code field} value, or {@code 0} when {@code field} is not present
* in the hash or {@code key} does not exist at all.
*/
AsyncExecutions<Long> hstrlen(K key, K field);

/**
* Get all the values in a hash.
*
* @param key the key
* @return List&lt;V&gt; array-reply list of values in the hash, or an empty list when {@code key} does not exist.
*/
AsyncExecutions<List<V>> hvals(K key);

/**
* Stream over all the values in a hash.
*
* @param channel streaming channel that receives a call for every value
* @param key the key
*
* @return Long count of the keys.
*/
AsyncExecutions<Long> hvals(ValueStreamingChannel<V> channel, K key);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@
public interface NodeSelectionKeyCommands<K, V> {

/**
* Delete a key.
*
* @param keys the key
* Delete one or more keys.
*
* @param keys the keys
* @return Long integer-reply The number of keys that were removed.
*/
Executions<Long> del(K... keys);

/**
* Unlink one or more keys (non blocking DEL).
*
* @param keys the keys
* @return Long integer-reply The number of keys that were removed.
*/
Executions<Long> unlink(K... keys);

/**
* Return a serialized version of the value stored at the specified key.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,21 @@ public interface NodeSelectionServerCommands<K, V> {
*/
Executions<Long> dbsize();

/**
* Crash and recover
* @param delay optional delay in milliseconds
* @return String simple-string-reply
*/
Executions<String> debugCrashAndRecover(Long delay);

/**
* Get debugging information about the internal hash-table state.
*
* @param db the database number
* @return String simple-string-reply
*/
Executions<String> debugHtstats(int db);

/**
* Get debugging information about a key.
*
Expand All @@ -155,12 +170,26 @@ public interface NodeSelectionServerCommands<K, V> {
Executions<String> debugObject(K key);

/**
* Get debugging information about the internal hash-table state.
* Save RDB, clear the database and reload RDB.
*
* @param db the database number
* @return String simple-string-reply The commands returns OK on success.
*/
Executions<String> debugReload();

/**
* Restart the server gracefully.
* @param delay optional delay in milliseconds
* @return String simple-string-reply
*/
Executions<String> debugHtstats(int db);
Executions<String> debugRestart(Long delay);

/**
* Get debugging information about the internal SDS length.
*
* @param key the key
* @return String simple-string-reply
*/
Executions<String> debugSdslen(K key);

/**
* Remove all keys from all databases.
Expand All @@ -169,13 +198,27 @@ public interface NodeSelectionServerCommands<K, V> {
*/
Executions<String> flushall();

/**
* Remove all keys asynchronously from all databases.
*
* @return String simple-string-reply
*/
Executions<String> flushallAsync();

/**
* Remove all keys from the current database.
*
* @return String simple-string-reply
*/
Executions<String> flushdb();

/**
* Remove all keys asynchronously from the current database.
*
* @return String simple-string-reply
*/
Executions<String> flushdbAsync();

/**
* Get information and statistics about the server.
*
Expand Down

0 comments on commit c4a817e

Please sign in to comment.