private ResultCompletes(ICompletes clientCompletes, object internalOutcome, bool hasOutcomeSet) { resultHolder = this; InternalClientCompletes = clientCompletes; InternalOutcome = internalOutcome; HasInternalOutcomeSet = hasOutcomeSet; }
public virtual void Send <T>(Actor actor, Action <T> consumer, ICompletes completes, string representation) { var messageIndex = sendIndex.IncrementAndGet(); var ringSendIndex = (int)(messageIndex % mailboxSize); int retries = 0; while (ringSendIndex == (int)(receiveIndex.Get() % mailboxSize)) { if (++retries >= mailboxSize) { if (closed.Get()) { return; } else { retries = 0; } } } messages[ringSendIndex].Set(actor, consumer, completes, representation); while (readyIndex.CompareAndSet(messageIndex - 1, messageIndex)) { } }
Action(object function) { this.function = function; this.defaultValue = default(TAct); this.hasDefaultValue = false; this.nestedCompletes = null; }
Action(object function, ICompletes <TAct> nestedCompletes) { this.function = function; this.defaultValue = default(TAct); this.hasDefaultValue = false; this.nestedCompletes = nestedCompletes; }
Action(object function, TAct defaultValue) { this.function = function; this.defaultValue = defaultValue; this.hasDefaultValue = true; this.nestedCompletes = null; }
Action(object function, TAct defaultValue, ICompletes <TAct> nestedCompletes) { this.function = function; this.defaultValue = defaultValue; this.hasDefaultValue = true; this.nestedCompletes = nestedCompletes; }
public void Set <TConsumer>(Actor actor, Action <TConsumer> consumer, ICompletes completes, string representation) { this.actor = actor; this.consumer = (TActor x) => consumer.Invoke((TConsumer)(object)x); this.representation = representation; this.completes = completes; }
public LocalMessage(Actor actor, Action <TActor> consumer, ICompletes completes, string representation) { this.actor = actor; this.consumer = consumer; this.representation = representation; this.completes = completes; }
public PooledCompletes( long id, ICompletes clientCompletes, ICompletesEventually completesEventually) { Id = id; ClientCompletes = clientCompletes; CompletesEventually = completesEventually; }
/// <summary> /// Answer my internal <see cref="ICompletes"/> from <c>Completes()</c> after preparing /// for the <paramref name="eventualOutcome"/> to be set in my <c>CompletesEventually()</c>. /// </summary> /// <param name="eventualOutcome">The <see cref="ICompletes"/> the provides an eventual outcome</param> /// <typeparam name="TR">The return type of <see cref="ICompletes"/></typeparam> /// <returns><see cref="ICompletes"/> of type <typeparamref name="TR"/></returns> protected internal ICompletes <TR> AnswerFrom <TR>(ICompletes <TR> eventualOutcome) { var completes = CompletesEventually(); eventualOutcome .OtherwiseConsume(value => completes.With(value)) .AndThenConsume(value => completes.With(value)); return((ICompletes <TR>)Completes()); }
public ICompletes <Response> RequestWith(Request request, ICompletes <Response> completes) { _completesEventually = Stage.World.CompletesFor(completes); if (_testId != EmptyTestId) { request.Headers.Add(RequestHeader.Of(Client.ClientIdCustomHeader, _testId)); request.Headers.Add(RequestHeader.Of(RequestHeader.XCorrelationID, _testId)); } _requestSender.SendRequest(request); StowMessages(typeof(IResponseChannelConsumer)); return(completes); }
public ICompletes <Response> RequestWith(Request request, ICompletes <Response> completes) { var correlationId = request.Headers.HeaderOf(RequestHeader.XCorrelationID); Request readyRequest; if (correlationId == null) { correlationId = RequestHeader.Of(RequestHeader.XCorrelationID, _randomUuidGenerator.GenerateGuid().ToString()); readyRequest = request.And(correlationId); } else { readyRequest = request; } _completables[correlationId !.Value !] = Stage.World.CompletesFor(completes);
public ICompletes <Response> RequestWith(Request request, ICompletes <Response> completes) { if (!_actor.IsStopped) { Action <IClientConsumer> consumer = actor => actor.RequestWith(request, completes); var innerCompletes = Completes.Using <Response>(_actor.Scheduler); if (_mailbox.IsPreallocated) { _mailbox.Send(_actor, consumer, innerCompletes, RequestWithRepresentation1); } else { _mailbox.Send(new LocalMessage <IClientConsumer>(_actor, consumer, innerCompletes, RequestWithRepresentation1)); } } else { _actor.DeadLetters?.FailedDelivery(new DeadLetter(_actor, RequestWithRepresentation1)); } return(null !); }
public ICompletesEventually ProvideCompletesFor(IAddress address, ICompletes clientCompletes) { ++provideCompletesForCount; return(completesEventually); }
public void Send <T>(Actor actor, Action <T> consumer, ICompletes completes, string representation) => throw new NotSupportedException("ExecutorDispatcherTest does not support this operation");
public CompletesEventuallyAdapter(ICompletes <Type> completes) { _completes = completes; }
private CompletesOutcomeT(ICompletes <IOutcome <TError, T> > value) => _value = value;
public void Send(Actor actor, Type protocol, LambdaExpression consumer, ICompletes completes, string representation) => throw new NotSupportedException("ExecutorDispatcherTest does not support this operation");
public StowedLocalMessage(Actor actor, Action <T> consumer, ICompletes <object> completes, string representation) : base(actor, consumer, completes, representation) { }
public ICompletes <Response> RequestWith(Request request, ICompletes <Response> completes) { DispatchCommand((a, b, c) => a.RequestWith(b, c), request, completes); return(completes); }
public ICompletes <Response> RequestWith(Request request, ICompletes <Response> completes) { DispatchCommand((consumer, r, c) => consumer.RequestWith(r, c), request, completes); return(completes); }
/// <summary> /// Answers a new <see cref="ICompletesEventually"/> instance that backs the <paramref name="clientCompletes"/>. /// This manages the <c>ICompletes</c> using the <code>ICompletesEventually</code> plugin <c>Actor</c> pool. /// </summary> /// <param name="clientCompletes">The <code>ICompletesEventually</code> allocated for eventual completion of <c>clientCompletes</c></param> /// <returns></returns> public ICompletesEventually CompletesFor(ICompletes clientCompletes) => completesProviderKeeper.FindDefault().ProvideCompletesFor(clientCompletes);
/// <summary> /// Answers a <see cref="ICompletesEventually"/> instance identified by <paramref name="address"/> that backs the <paramref name="clientCompletes"/>. /// This manages the <code>ICompletes</code> using the <code>ICompletesEventually</code> plugin <code>Actor</code> pool. /// </summary> /// <param name="address">The address of the ICompletesEventually actor to reuse.</param> /// <param name="clientCompletes">The <code>ICompletesEventually</code> allocated for eventual completion of <code>clientCompletes</code></param> /// <returns></returns> public ICompletesEventually CompletesFor(IAddress address, ICompletes clientCompletes) => completesProviderKeeper.FindDefault().ProvideCompletesFor(address, clientCompletes);
public override void Reset(ICompletes clientCompletes) { InternalClientCompletes = clientCompletes; InternalOutcome = null; HasInternalOutcomeSet = false; }
public CompletesAwaiter(ICompletes <T> completes) => _completes = completes;
/// <summary> /// Answer my internal <see cref="ICompletes"/> from <c>Completes()</c> after preparing /// for the <paramref name="eventualOutcome"/> to be set in my <c>CompletesEventually()</c>. /// </summary> /// <param name="eventualOutcome">The <see cref="ICompletes"/> the provides an eventual outcome</param> /// <typeparam name="R">The return type of <see cref="ICompletes"/></typeparam> /// <returns><see cref="ICompletes"/> of type <typeparamref name="R"/></returns> protected internal ICompletes <R> AnswerFrom <R>(ICompletes <R> eventualOutcome) { eventualOutcome.AndThenConsume(value => CompletesEventually().With(value)); return((ICompletes <R>)Completes()); }
public void Send <T>(Actor actor, Action <T> consumer, ICompletes completes, string representation) { throw new NotSupportedException("Not a preallocated mailbox."); }
protected internal static Action <TAct> With(object function, ICompletes <TAct> nestedCompletes) => new Action <TAct>(function, nestedCompletes);
public ICompletesEventually ProvideCompletesFor(ICompletes clientCompletes) => new PooledCompletes(completesEventuallyId.GetAndIncrement(), clientCompletes, CompletesEventually);
protected internal static Action <TAct> With(object function, TAct defaultValue, ICompletes <TAct> nestedCompletes) => new Action <TAct>(function, defaultValue, nestedCompletes);