Exemplo n.º 1
0
        private void AmendResults(ExecutionPlan plan, RESPObject[] responses)
        {
            if (plan.IsTransaction)
            {
                Transaction.Consolidate(responses, plan.Headers);
            }

            if (plan.HasScripts)
            {
                Procedure.AmmendScriptErrors(responses, plan.Headers, _procedures);
            }
        }
Exemplo n.º 2
0
        private Tuple <ICommandOperation, ISubscriptionOperation, RESPObject[]> Pack <T>(ExecutionPlan plan, T parameters)
            where T : class
        {
            var respCommand          = plan.Bind(parameters);
            var responsesPlaceholder = new RESPObject[respCommand.Length];

            ICommandOperation      commandOperation = null;
            ISubscriptionOperation subOp            = null;

            var hasSubscriptions = false;
            var hasCommands      = false;

            IdentifyOperationMainRoute(respCommand, ref hasCommands, ref hasSubscriptions);

            if (!hasCommands && !hasSubscriptions)
            {
                throw new RedisClientParsingException("The given RESP commands do not contain Redis commands.");
            }

            if (hasCommands)
            {
                commandOperation = new CommandOperation(respCommand, responsesPlaceholder, _procedures);
            }

            if (hasSubscriptions)
            {
                if (_subscriber == null)
                {
                    _subscriber = _subscribers.Provide();
                }
                subOp = new SubscriptionOperation(this, respCommand, responsesPlaceholder, _subscriber.Subscriptions);
            }

            return(new Tuple <ICommandOperation, ISubscriptionOperation, RESPObject[]>(commandOperation, subOp, responsesPlaceholder));
        }