Пример #1
0
 static void SetQueuedAsDiscarded(RESPObject[] results, String[] commandHeaders, ref Int32 i)
 {
     while (i >= 0 && !commandHeaders[i].Equals("MULTI", StringComparison.Ordinal))
     {
         var element = results[i];
         if (RESPString.IsString(element.Header) && RESPString.Same(element, "QUEUED"))
         {
             results[i] = RESPSimpleString.DISCARDED;
         }
         i--;
     }
 }
Пример #2
0
        static void ZipQueuedAndResults(RESPObject[] results, ref Int32 index)
        {
            Contract.Assert(results.Any(), "Passing empty results to zip.");

            var result = results[index];

            if (result.Header == RESPHeaders.BulkString && RESPString.Same(result, null))
            {
                // EXEC failed due WATCH
                results[index] = RESPError.EXECWATCHFAILED;
            }
            else
            {
                index = ZipUpResults(results, index, result);
            }
        }
Пример #3
0
        static int ZipUpResults(RESPObject[] results, Int32 index, RESPObject result)
        {
            var array = result.Cast <RESPArray>();

            results[index] = RESPSimpleString.OK;
            index--;
            var arrayIndex = array.Count - 1;

            while (index >= 0 && arrayIndex >= 0)
            {
                var element = results[index];
                if (RESPString.IsString(element.Header) && RESPString.Same(element, "QUEUED"))
                {
                    results[index] = array[arrayIndex];
                    arrayIndex--;
                }

                index--;
            }
            return(index);
        }