Skip to content

Commit

Permalink
add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vazois committed Jun 11, 2024
1 parent 14d54f5 commit 3d7d3b2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions libs/common/RespReadUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ private static bool TryReadInt(ref byte* ptr, byte* end, out int value, out ulon
/// <summary>
/// Tries to read a RESP length header from the given ASCII-encoded RESP string
/// and, if successful, moves the given ptr to the end of the length header.
/// NOTE: It will throws an exception if length header is negative.
/// NOTE:
/// It will throw an exception if length header is negative.
/// It is primarily used for parsing header length from packets received from server side.
/// </summary>
/// <param name="length">If parsing was successful, contains the extracted length from the header.</param>
/// <param name="ptr">The starting position in the RESP string. Will be advanced if parsing is successful.</param>
Expand Down Expand Up @@ -241,7 +243,10 @@ public static bool ReadUnsignedLengthHeader(out int length, ref byte* ptr, byte*
/// <summary>
/// Tries to read a RESP a signed length header from the given ASCII-encoded RESP string
/// and, if successful, moves the given ptr to the end of the length header.
/// NOTE: It will not throw an exception if length header is negative.
/// NOTE:
/// It will not throw an exception if length header is negative.
/// It is primarily used by client side code.
/// Should not be called by any server code since server side does not accept null values
/// </summary>
/// <param name="length">If parsing was successful, contains the extracted length from the header.</param>
/// <param name="ptr">The starting position in the RESP string. Will be advanced if parsing is successful.</param>
Expand Down Expand Up @@ -354,6 +359,7 @@ public static bool Read64Int(out long number, ref byte* ptr, byte* end)
/// <summary>
/// Tries to read a RESP array length header from the given ASCII-encoded RESP string
/// and, if successful, moves the given ptr to the end of the length header.
/// NOTE: We use ReadUnsignedLengthHeader because server does not accept $-1\r\n headers
/// </summary>
/// <param name="length">If parsing was successful, contains the extracted length from the header.</param>
/// <param name="ptr">The starting position in the RESP string. Will be advanced if parsing is successful.</param>
Expand Down Expand Up @@ -614,6 +620,7 @@ public static bool ReadBoolWithLengthHeader(out bool result, ref byte* ptr, byte
/// <summary>
/// Tries to read a RESP-formatted string including its length header from the given ASCII-encoded
/// RESP message and, if successful, moves the given ptr to the end of the string value.
/// NOTE: We use ReadUnsignedLengthHeader because server does not accept $-1\r\n headers
/// </summary>
/// <param name="result">If parsing was successful, contains the extracted string value.</param>
/// <param name="ptr">The starting position in the RESP message. Will be advanced if parsing is successful.</param>
Expand Down Expand Up @@ -712,6 +719,7 @@ public static bool ReadIntegerAsString(out string result, ref byte* ptr, byte* e

/// <summary>
/// Read string array with length header
/// NOTE: We use ReadUnsignedLengthHeader because server does not accept *-1\r\n headers.
/// </summary>
public static bool ReadStringArrayWithLengthHeader(out string[] result, ref byte* ptr, byte* end)
{
Expand Down

0 comments on commit 3d7d3b2

Please sign in to comment.