Skip to content

Commit

Permalink
Cleanup: removing evil (#2081)
Browse files Browse the repository at this point in the history
Removes the #regions that divide us! (I couldn't find an .editorconfig for this, but removing from existing codebase helps makes it clear for future PRs!)
  • Loading branch information
NickCraver authored Apr 12, 2022
1 parent ba352d2 commit a64f74f
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 23 deletions.
4 changes: 0 additions & 4 deletions src/StackExchange.Redis/Interfaces/IServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,6 @@ public partial interface IServer : IRedis
/// <remarks>https://redis.io/commands/memory-malloc-stats</remarks>
string? MemoryAllocatorStats(CommandFlags flags = CommandFlags.None);

#region Sentinel

/// <summary>
/// Returns the IP and port number of the primary with that name.
/// If a failover is in progress or terminated successfully for this primary it returns the address and port of the promoted replica.
Expand Down Expand Up @@ -1000,8 +998,6 @@ public partial interface IServer : IRedis
/// <param name="flags">The command flags to use.</param>
/// <remarks>https://redis.io/topics/sentinel</remarks>
Task<KeyValuePair<string, string>[][]> SentinelSentinelsAsync(string serviceName, CommandFlags flags = CommandFlags.None);

#endregion
}

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions src/StackExchange.Redis/Profiling/ProfiledCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ internal sealed class ProfiledCommand : IProfiledCommand
{
private static readonly double TimestampToTicks = TimeSpan.TicksPerSecond / (double)Stopwatch.Frequency;

#region IProfiledCommand Impl
public EndPoint EndPoint => Server.EndPoint;

public int Db => Message!.Db;
Expand Down Expand Up @@ -42,8 +41,6 @@ private static TimeSpan GetElapsedTime(long timestampDelta)

public RetransmissionReasonType? RetransmissionReason { get; }

#endregion

public ProfiledCommand? NextElement { get; set; }

private Message? Message;
Expand Down
4 changes: 0 additions & 4 deletions src/StackExchange.Redis/RedisServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,6 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
}
}

#region Sentinel

public EndPoint? SentinelGetMasterAddressByName(string serviceName, CommandFlags flags = CommandFlags.None)
{
var msg = Message.Create(-1, flags, RedisCommand.SENTINEL, RedisLiterals.GETMASTERADDRBYNAME, (RedisValue)serviceName);
Expand Down Expand Up @@ -988,8 +986,6 @@ public Task<KeyValuePair<string, string>[][]> SentinelSentinelsAsync(string serv
return ExecuteAsync(msg, ResultProcessor.SentinelArrayOfArrays, defaultValue: Array.Empty<KeyValuePair<string, string>[]>());
}

#endregion

public RedisResult Execute(string command, params object[] args) => Execute(command, args, CommandFlags.None);

public RedisResult Execute(string command, ICollection<object> args, CommandFlags flags = CommandFlags.None)
Expand Down
8 changes: 0 additions & 8 deletions src/StackExchange.Redis/ResultProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ public static readonly ResultProcessor<string?>
TieBreaker = new TieBreakerProcessor(),
ClusterNodesRaw = new ClusterNodesRawProcessor();

#region Sentinel

public static readonly ResultProcessor<EndPoint?>
SentinelPrimaryEndpoint = new SentinelGetPrimaryAddressByNameProcessor();

Expand All @@ -143,8 +141,6 @@ public static readonly ResultProcessor<EndPoint[]>
public static readonly ResultProcessor<KeyValuePair<string, string>[][]>
SentinelArrayOfArrays = new SentinelArrayOfArraysProcessor();

#endregion

public static readonly ResultProcessor<KeyValuePair<string, string>[]>
StringPairInterleaved = new StringPairInterleavedProcessor();
public static readonly TimeSpanProcessor
Expand Down Expand Up @@ -2188,8 +2184,6 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
}
}

#region Sentinel

private sealed class SentinelGetPrimaryAddressByNameProcessor : ResultProcessor<EndPoint?>
{
protected override bool SetResultCore(PhysicalConnection connection, Message message, in RawResult result)
Expand Down Expand Up @@ -2324,8 +2318,6 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
return false;
}
}

#endregion
}

internal abstract class ResultProcessor<T> : ResultProcessor
Expand Down
4 changes: 0 additions & 4 deletions tests/StackExchange.Redis.Tests/Helpers/redis-sharp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,6 @@ public byte[][] SendDataCommandExpectMultiBulkReply(byte[] data, string command,
throw new ResponseException("Unknown reply on multi-request: " + c + s);
}

#region List commands
public byte[][] ListRange(string key, int start, int end)
{
return SendDataCommandExpectMultiBulkReply(null, "LRANGE {0} {1} {2}\r\n", key, start, end);
Expand All @@ -685,9 +684,7 @@ public byte[] LeftPop(string key)
SendCommand("LPOP {0}\r\n", key);
return ReadData();
}
#endregion

#region Set commands
public bool AddToSet(string key, byte[] member)
{
return SendDataExpectInt(member, "SADD {0} {1}\r\n", key, member.Length) > 0;
Expand Down Expand Up @@ -795,7 +792,6 @@ public bool MoveMemberToSet(string srcKey, string destKey, byte[] member)
{
return SendDataExpectInt(member, "SMOVE {0} {1} {2}\r\n", srcKey, destKey, member.Length) > 0;
}
#endregion

public void Dispose()
{
Expand Down

0 comments on commit a64f74f

Please sign in to comment.