Commit 0ff068e9 authored by Nick Craver's avatar Nick Craver

Cleanup: Interfaces

Still a lot of docs work to follow-up with here.
parent 1a25068a
namespace StackExchange.Redis
{
/// <summary>
/// If an IProfiledCommand is a retransmission of a previous command, this enum
/// is used to indicate what prompted the retransmission.
///
/// This can be used to distinguish between transient causes (moving hashslots, joining nodes, etc.)
/// and incorrect routing.
/// </summary>
public enum RetransmissionReasonType
{
/// <summary>
/// No stated reason
/// </summary>
None = 0,
/// <summary>
/// Issued to investigate which node owns a key
/// </summary>
Ask,
/// <summary>
/// A node has indicated that it does *not* own the given key
/// </summary>
Moved
}
}
......@@ -2,7 +2,7 @@
namespace StackExchange.Redis
{
interface ICompletable
internal interface ICompletable
{
void AppendStormLog(StringBuilder sb);
......
......@@ -10,7 +10,6 @@ namespace StackExchange.Redis
/// </summary>
public interface IConnectionMultiplexer
{
#if DEBUG
/// <summary>
/// For debugging; when not enabled, servers cannot connect
......
......@@ -4,13 +4,11 @@
namespace StackExchange.Redis
{
/// <summary>
/// Describes functionality that is common to both standalone redis servers and redis clusters
/// </summary>
public interface IDatabase : IRedis, IDatabaseAsync
{
/// <summary>
/// The numeric identifier of this database
/// </summary>
......@@ -23,14 +21,12 @@ public interface IDatabase : IRedis, IDatabaseAsync
[IgnoreNamePrefix]
IBatch CreateBatch(object asyncState = null);
/// <summary>
/// Atomically transfer a key from a source Redis instance to a destination Redis instance. On success the key is deleted from the original instance by default, and is guaranteed to exist in the target instance.
/// </summary>
/// <remarks>http://redis.io/commands/MIGRATE</remarks>
void KeyMigrate(RedisKey key, EndPoint toServer, int toDatabase = 0, int timeoutMilliseconds = 0, MigrateOptions migrateOptions = MigrateOptions.None, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Allows creation of a group of operations that will be sent to the server as a single unit,
/// and processed on the server as a single unit.
......@@ -51,7 +47,6 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// <remarks>http://redis.io/commands/geoadd</remarks>
bool GeoAdd(RedisKey key, double longitude, double latitude, RedisValue member, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Add the specified member to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.
/// </summary>
......@@ -59,7 +54,6 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// <remarks>http://redis.io/commands/geoadd</remarks>
bool GeoAdd(RedisKey key, StackExchange.Redis.GeoEntry value, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Add the specified members to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.
/// </summary>
......@@ -95,7 +89,6 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// <remarks>http://redis.io/commands/geohash</remarks>
string GeoHash(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
/// </summary>
......@@ -549,7 +542,6 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// <returns>A dynamic representation of the command's result</returns>
RedisResult Execute(string command, ICollection<object> args, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Execute a Lua script against the server
/// </summary>
......@@ -822,8 +814,6 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// <remarks>http://redis.io/commands/zrevrange</remarks>
SortedSetEntry[] SortedSetRangeByRankWithScores(RedisKey key, long start = 0, long stop = -1, Order order = Order.Ascending, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the specified range of elements in the sorted set stored at key. By default the elements are considered to be ordered from the lowest to the highest score. Lexicographical order is used for elements with equal score.
/// Start and stop are used to specify the min and max range for score values. Similar to other range methods the values are inclusive.
......@@ -919,10 +909,6 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// <remarks>http://redis.io/commands/zscore</remarks>
double? SortedSetScore(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
/// <summary>
/// If key already exists and is a string, this command appends the value at the end of the string. If key does not exist it is created and set as an empty string,
/// so APPEND will be similar to SET in this special case.
......
......@@ -23,7 +23,6 @@ public interface IDatabaseAsync : IRedisAsync
/// <remarks>https://redis.io/commands/geoadd</remarks>
Task<bool> GeoAddAsync(RedisKey key, double longitude, double latitude, RedisValue member, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Add the specified member to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.
/// </summary>
......@@ -31,7 +30,6 @@ public interface IDatabaseAsync : IRedisAsync
/// <remarks>https://redis.io/commands/geoadd</remarks>
Task<bool> GeoAddAsync(RedisKey key, StackExchange.Redis.GeoEntry value, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Add the specified members to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.
/// </summary>
......@@ -67,7 +65,6 @@ public interface IDatabaseAsync : IRedisAsync
/// <remarks>https://redis.io/commands/geohash</remarks>
Task<string> GeoHashAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
/// </summary>
......@@ -96,7 +93,6 @@ public interface IDatabaseAsync : IRedisAsync
/// <remarks>https://redis.io/commands/georadius</remarks>
Task<GeoRadiusResult[]> GeoRadiusAsync(RedisKey key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.Meters, int count = -1, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Increments the number stored at field in the hash stored at key by increment. If key does not exist, a new key holding a hash is created. If field does not exist or holds a string that cannot be interpreted as integer, the value is set to 0 before the operation is performed.
/// </summary>
......@@ -310,7 +306,6 @@ public interface IDatabaseAsync : IRedisAsync
/// <remarks>https://redis.io/commands/persist</remarks>
Task<bool> KeyExpireAsync(RedisKey key, DateTime? expiry, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Atomically transfer a key from a source Redis instance to a destination Redis instance. On success the key is deleted from the original instance by default, and is guaranteed to exist in the target instance.
/// </summary>
......@@ -521,7 +516,6 @@ public interface IDatabaseAsync : IRedisAsync
/// <returns>A dynamic representation of the command's result</returns>
Task<RedisResult> ExecuteAsync(string command, params object[] args);
/// <summary>
/// Execute an arbitrary command against the server; this is primarily intended for
/// executing modules, but may also be used to provide access to new features that lack
......@@ -863,7 +857,6 @@ public interface IDatabaseAsync : IRedisAsync
/// <remarks>https://redis.io/commands/zscore</remarks>
Task<double?> SortedSetScoreAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
/// <summary>
/// If key already exists and is a string, this command appends the value at the end of the string. If key does not exist it is created and set as an empty string,
/// so APPEND will be similar to SET in this special case.
......@@ -1015,7 +1008,6 @@ public interface IDatabaseAsync : IRedisAsync
Task<RedisValue> StringSetRangeAsync(RedisKey key, long offset, RedisValue value, CommandFlags flags = CommandFlags.None);
}
/// <summary>
/// Describes a value/expiry pair
/// </summary>
......
......@@ -3,29 +3,6 @@
namespace StackExchange.Redis
{
/// <summary>
/// If an IProfiledCommand is a retransmission of a previous command, this enum
/// is used to indicate what prompted the retransmission.
///
/// This can be used to distinguish between transient causes (moving hashslots, joining nodes, etc.)
/// and incorrect routing.
/// </summary>
public enum RetransmissionReasonType
{
/// <summary>
/// No stated reason
/// </summary>
None = 0,
/// <summary>
/// Issued to investigate which node owns a key
/// </summary>
Ask,
/// <summary>
/// A node has indicated that it does *not* own the given key
/// </summary>
Moved
}
/// <summary>
/// A profiled command against a redis instance.
///
......
......@@ -11,32 +11,12 @@ public partial interface IRedis : IRedisAsync
/// <summary>
/// This command is often used to test if a connection is still alive, or to measure latency.
/// </summary>
/// <param name="flags">The command flags to use when pinging.</param>
/// <returns>The observed latency.</returns>
/// <remarks>https://redis.io/commands/ping</remarks>
TimeSpan Ping(CommandFlags flags = CommandFlags.None);
}
/// <summary>
/// Represents a resumable, cursor-based scanning operation
/// </summary>
public interface IScanningCursor
{
/// <summary>
/// Returns the cursor that represents the *active* page of results (not the pending/next page of results as returned by SCAN/HSCAN/ZSCAN/SSCAN)
/// </summary>
long Cursor { get; }
/// <summary>
/// The page size of the current operation
/// </summary>
int PageSize { get; }
/// <summary>
/// The offset into the current page
/// </summary>
int PageOffset { get; }
}
[Conditional("DEBUG")]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
internal class IgnoreNamePrefixAttribute : Attribute
......@@ -46,6 +26,6 @@ public IgnoreNamePrefixAttribute(bool ignoreEntireMethod = false)
IgnoreEntireMethod = ignoreEntireMethod;
}
public bool IgnoreEntireMethod { get; private set; }
public bool IgnoreEntireMethod { get; }
}
}
\ No newline at end of file
......@@ -19,6 +19,7 @@ public partial interface IRedisAsync
/// <returns>The observed latency.</returns>
/// <remarks>https://redis.io/commands/ping</remarks>
Task<TimeSpan> PingAsync(CommandFlags flags = CommandFlags.None);
/// <summary>
/// Wait for a given asynchronous operation to complete (or timeout), reporting which
/// </summary>
......@@ -28,14 +29,15 @@ public partial interface IRedisAsync
/// Wait for a given asynchronous operation to complete (or timeout)
/// </summary>
void Wait(Task task);
/// <summary>
/// Wait for a given asynchronous operation to complete (or timeout)
/// </summary>
T Wait<T>(Task<T> task);
/// <summary>
/// Wait for the given asynchronous operations to complete (or timeout)
/// </summary>
void WaitAll(params Task[] tasks);
}
}
namespace StackExchange.Redis
{
/// <summary>
/// Represents a resumable, cursor-based scanning operation
/// </summary>
public interface IScanningCursor
{
/// <summary>
/// Returns the cursor that represents the *active* page of results (not the pending/next page of results as returned by SCAN/HSCAN/ZSCAN/SSCAN)
/// </summary>
long Cursor { get; }
/// <summary>
/// The page size of the current operation
/// </summary>
int PageSize { get; }
/// <summary>
/// The offset into the current page
/// </summary>
int PageOffset { get; }
}
}
\ No newline at end of file
......@@ -74,6 +74,7 @@ public partial interface IServer : IRedis
/// <returns>the number of clients killed.</returns>
/// <remarks>https://redis.io/commands/client-kill</remarks>
long ClientKill(long? id = null, ClientType? clientType = null, EndPoint endpoint = null, bool skipMe = true, CommandFlags flags = CommandFlags.None);
/// <summary>
/// The CLIENT KILL command closes multiple connections that match the specified filters
/// </summary>
......@@ -349,6 +350,7 @@ public partial interface IServer : IRedis
/// </summary>
/// <remarks>https://redis.io/commands/slaveof</remarks>
void SlaveOf(EndPoint master, CommandFlags flags = CommandFlags.None);
/// <summary>
/// The SLAVEOF command can change the replication settings of a slave on the fly. If a Redis server is already acting as slave, specifying a null master will turn off the replication, turning the Redis server into a MASTER. Specifying a non-null master will make the server a slave of another server listening at the specified hostname and port.
/// </summary>
......@@ -360,21 +362,25 @@ public partial interface IServer : IRedis
/// </summary>
/// <remarks>https://redis.io/commands/slowlog</remarks>
CommandTrace[] SlowlogGet(int count = 0, CommandFlags flags = CommandFlags.None);
/// <summary>
/// To read the slow log the SLOWLOG GET command is used, that returns every entry in the slow log. It is possible to return only the N most recent entries passing an additional argument to the command (for instance SLOWLOG GET 10).
/// </summary>
/// <remarks>https://redis.io/commands/slowlog</remarks>
Task<CommandTrace[]> SlowlogGetAsync(int count = 0, CommandFlags flags = CommandFlags.None);
/// <summary>
/// You can reset the slow log using the SLOWLOG RESET command. Once deleted the information is lost forever.
/// </summary>
/// <remarks>https://redis.io/commands/slowlog</remarks>
void SlowlogReset(CommandFlags flags = CommandFlags.None);
/// <summary>
/// You can reset the slow log using the SLOWLOG RESET command. Once deleted the information is lost forever.
/// </summary>
/// <remarks>https://redis.io/commands/slowlog</remarks>
Task SlowlogResetAsync(CommandFlags flags = CommandFlags.None);
/// <summary>
/// Lists the currently active channels. An active channel is a Pub/Sub channel with one ore more subscribers (not including clients subscribed to patterns).
/// </summary>
......@@ -421,6 +427,7 @@ public partial interface IServer : IRedis
/// <returns>The server's current time.</returns>
/// <remarks>https://redis.io/commands/time</remarks>
DateTime Time(CommandFlags flags = CommandFlags.None);
/// <summary>
/// The TIME command returns the current server time.
/// </summary>
......@@ -523,7 +530,4 @@ public partial interface IServer : IRedis
#endregion
}
}
\ No newline at end of file
......@@ -9,7 +9,6 @@ namespace StackExchange.Redis
/// </summary>
public interface ISubscriber : IRedis
{
/// <summary>
/// Inidicate exactly which redis server we are talking to
/// </summary>
......@@ -36,12 +35,14 @@ public interface ISubscriber : IRedis
/// <returns>the number of clients that received the message.</returns>
/// <remarks>https://redis.io/commands/publish</remarks>
long Publish(RedisChannel channel, RedisValue message, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Posts a message to the given channel.
/// </summary>
/// <returns>the number of clients that received the message.</returns>
/// <remarks>https://redis.io/commands/publish</remarks>
Task<long> PublishAsync(RedisChannel channel, RedisValue message, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Subscribe to perform some operation when a change to the preferred/active node is broadcast.
/// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment