Skip to content

Commit

Permalink
introduced descriptive name
Browse files Browse the repository at this point in the history
  • Loading branch information
vazois committed Jun 10, 2024
1 parent 77b64cd commit 881c121
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion libs/client/ClientSession/GarnetClientSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ private int ProcessReplies(byte* recvBufferPtr, int bytesRead)
break;

case (byte)'$':
if (!RespReadUtils.ReadStringOrNullWithLengthHeader(out result, ref ptr, recvBufferPtr + bytesRead))
if (!RespReadUtils.ReadStringResponseWithLengthHeader(out result, ref ptr, recvBufferPtr + bytesRead))
success = false;
break;

Expand Down
10 changes: 5 additions & 5 deletions libs/client/GarnetClientProcessReplies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ unsafe bool ProcessReplyAsString(ref byte* ptr, byte* end, out string result, ou
break;

case (byte)'$':
if (!RespReadUtils.ReadStringOrNullWithLengthHeader(out result, ref ptr, end))
if (!RespReadUtils.ReadStringResponseWithLengthHeader(out result, ref ptr, end))
return false;
break;

Expand Down Expand Up @@ -127,7 +127,7 @@ unsafe bool ProcessReplyAsStringArray(ref byte* ptr, byte* end, out string[] res
break;

case (byte)'$':
if (!RespReadUtils.ReadStringOrNullWithLengthHeader(out _result, ref ptr, end))
if (!RespReadUtils.ReadStringResponseWithLengthHeader(out _result, ref ptr, end))
return false;
result = [_result];
break;
Expand Down Expand Up @@ -174,12 +174,12 @@ unsafe bool ProcessReplyAsMemoryByte(ref byte* ptr, byte* end, out MemoryResult<
break;

case (byte)'$':
if (!RespReadUtils.ReadStringWithLengthHeader(memoryPool, out result, ref ptr, end))
if (!RespReadUtils.ReadStringResponseWithLengthHeader(memoryPool, out result, ref ptr, end))
return false;
break;

case (byte)'*':
if (!RespReadUtils.ReadStringArrayWithLengthHeader(memoryPool, out var resultArray, ref ptr, end))
if (!RespReadUtils.ReadStringResponseArrayWithLengthHeader(memoryPool, out var resultArray, ref ptr, end))
return false;
// Return first element of array
for (var i = 1; i < resultArray.Length; i++)
Expand All @@ -202,7 +202,7 @@ unsafe bool ProcessReplyAsMemoryByteArray(ref byte* ptr, byte* end, out MemoryRe
switch (*ptr)
{
case (byte)'*':
if (!RespReadUtils.ReadStringArrayWithLengthHeader(memoryPool, out var resultArray, ref ptr, end))
if (!RespReadUtils.ReadStringResponseArrayWithLengthHeader(memoryPool, out var resultArray, ref ptr, end))
return false;
result = resultArray;
break;
Expand Down
8 changes: 4 additions & 4 deletions libs/common/RespReadUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ public static bool ReadSerializedData(out byte[] key, out byte[] value, out long
/// <param name="ptr"></param>
/// <param name="end"></param>
/// <returns></returns>
public static bool ReadStringOrNullWithLengthHeader(out string result, ref byte* ptr, byte* end)
public static bool ReadStringResponseWithLengthHeader(out string result, ref byte* ptr, byte* end)
{
result = null;

Expand Down Expand Up @@ -977,7 +977,7 @@ public static bool ReadStringOrNullWithLengthHeader(out string result, ref byte*
/// <param name="ptr">The starting position in the RESP message. Will be advanced if parsing is successful.</param>
/// <param name="end">The current end of the RESP message.</param>
/// <returns>True if a RESP string was successfully read.</returns>
public static bool ReadStringWithLengthHeader(MemoryPool<byte> pool, out MemoryResult<byte> result, ref byte* ptr, byte* end)
public static bool ReadStringResponseWithLengthHeader(MemoryPool<byte> pool, out MemoryResult<byte> result, ref byte* ptr, byte* end)
{
result = default;
if (ptr + 3 > end)
Expand Down Expand Up @@ -1015,7 +1015,7 @@ public static bool ReadStringWithLengthHeader(MemoryPool<byte> pool, out MemoryR
/// <summary>
/// Read string array with length header
/// </summary>
public static bool ReadStringArrayWithLengthHeader(MemoryPool<byte> pool, out MemoryResult<byte>[] result, ref byte* ptr, byte* end)
public static bool ReadStringResponseArrayWithLengthHeader(MemoryPool<byte> pool, out MemoryResult<byte>[] result, ref byte* ptr, byte* end)
{
result = null;
// Parse RESP array header
Expand All @@ -1036,7 +1036,7 @@ public static bool ReadStringArrayWithLengthHeader(MemoryPool<byte> pool, out Me
{
if (*ptr == '$')
{
if (!ReadStringWithLengthHeader(pool, out result[i], ref ptr, end))
if (!ReadStringResponseWithLengthHeader(pool, out result[i], ref ptr, end))
return false;
}
else
Expand Down

0 comments on commit 881c121

Please sign in to comment.