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)); }
public SubscriptionItem(ISubscriptionOperation operation, int maxRetries, TimeSpan timeout) { Ensure.NotNull(operation, "operation"); Operation = operation; MaxRetries = maxRetries; Timeout = timeout; CreatedTime = DateTime.UtcNow; CorrelationId = Guid.NewGuid(); RetryCount = 0; LastUpdated = DateTime.UtcNow; }
public SubscriptionItem(ISubscriptionOperation operation, int maxRetries, TimeSpan timeout) { Ensure.NotNull(operation, "operation"); Operation = operation; MaxRetries = maxRetries; Timeout = timeout; CreatedTime = DateTime.UtcNow; CorrelationId = Guid.NewGuid(); RetryCount = 0; LastUpdated = DateTime.UtcNow; }
internal ExecutionToken(ICommandOperation commandOperation, ISubscriptionOperation subscriptionOperation) { Contract.Assert(commandOperation != null || subscriptionOperation != null, "In ExecutionToken both operations cannot be null."); CommandOperation = commandOperation; SubscriptionOperation = subscriptionOperation; if (commandOperation != null) { _signalingsNeeded++; } if (subscriptionOperation != null) { _signalingsNeeded++; } }
internal SyncExecutionToken(ICommandOperation commandOperation, ISubscriptionOperation subscriptionOperation) : base(commandOperation, subscriptionOperation) { _reset = new ManualResetEventSlim(false); }
internal AsyncExecutionToken(ICommandOperation commandOperation, ISubscriptionOperation subscriptionOperation) : base(commandOperation, subscriptionOperation) { _completion = new TaskCompletionSource <Object>(); }
internal NoWaitExecutionToken(ICommandOperation commandOperation, ISubscriptionOperation subscriptionOperation) : base(commandOperation, subscriptionOperation) { }