Commit 9c2a20d7 authored by Marc Gravell's avatar Marc Gravell

make SlaveOf[Async] public on IServer

parent f8d2fb38
...@@ -297,6 +297,17 @@ public partial interface IServer : IRedis ...@@ -297,6 +297,17 @@ public partial interface IServer : IRedis
/// <remarks>http://redis.io/commands/shutdown</remarks> /// <remarks>http://redis.io/commands/shutdown</remarks>
void Shutdown(ShutdownMode shutdownMode = ShutdownMode.Default, CommandFlags flags = CommandFlags.None); void Shutdown(ShutdownMode shutdownMode = ShutdownMode.Default, 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>
/// <remarks>http://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>
/// <remarks>http://redis.io/commands/slaveof</remarks>
Task SlaveOfAsync(EndPoint master, CommandFlags flags = CommandFlags.None);
/// <summary> /// <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). /// 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> /// </summary>
......
...@@ -496,7 +496,7 @@ internal override RedisFeatures GetFeatures(int db, RedisKey key, CommandFlags f ...@@ -496,7 +496,7 @@ internal override RedisFeatures GetFeatures(int db, RedisKey key, CommandFlags f
return new RedisFeatures(server.Version); return new RedisFeatures(server.Version);
} }
internal void SlaveOf(EndPoint endpoint, CommandFlags flags = CommandFlags.None) public void SlaveOf(EndPoint endpoint, CommandFlags flags = CommandFlags.None)
{ {
var msg = CreateSlaveOfMessage(endpoint, flags); var msg = CreateSlaveOfMessage(endpoint, flags);
if (endpoint == server.EndPoint) if (endpoint == server.EndPoint)
...@@ -506,6 +506,16 @@ internal void SlaveOf(EndPoint endpoint, CommandFlags flags = CommandFlags.None) ...@@ -506,6 +506,16 @@ internal void SlaveOf(EndPoint endpoint, CommandFlags flags = CommandFlags.None)
ExecuteSync(msg, ResultProcessor.DemandOK); ExecuteSync(msg, ResultProcessor.DemandOK);
} }
public Task SlaveOfAsync(EndPoint endpoint, CommandFlags flags = CommandFlags.None)
{
var msg = CreateSlaveOfMessage(endpoint, flags);
if (endpoint == server.EndPoint)
{
throw new ArgumentException("Cannot slave to self");
}
return ExecuteAsync(msg, ResultProcessor.DemandOK);
}
private void FixFlags(Message message, ServerEndPoint server) private void FixFlags(Message message, ServerEndPoint server)
{ {
// since the server is specified explicitly, we don't want defaults // since the server is specified explicitly, we don't want defaults
......
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