Ejemplo n.º 1
0
        public void StartOrResume(Process process, OrchestrationInfo <TRequest, TReturn> info)
        {
            this.process  = process;
            this.info     = info;
            Clock         = StartingClock;
            Continuations = new Dictionary <ulong, IContinuationInfo>();

            Task = Run();

            CheckIfDone();
        }
        public void RestoreStateTo(Process process)
        {
            this.process = process;
            this.info    = (OrchestrationInfo <TRequest, TReturn>)process.Orchestrations[typeof(TRequest)];

            process.RecordReplayTracer?.Invoke($"[o{Opid:D10}-Replay] Replaying o{Opid:D10} {typeof(TRequest)}");

            process.OrchestrationStates[Opid] = this;
            StartOrResume();
            Debug.Assert(Continuations.Count != 0);

            while (HistoryPosition < History.Count)
            {
                var next = History[HistoryPosition];
                Debug.Assert(next.type.IsResponse());
                Continue(next.opid, next.clock, next.type, next.value);
                Debug.Assert(Continuations.Count != 0);
            }
        }
        public OrchestrationState(
            Process process,
            OrchestrationInfo <TRequest, TReturn> info,
            ulong opid,
            TRequest request,
            OrchestrationType orchestrationType,
            bool lockedByCaller,
            ulong parent,
            ulong clock)
        {
            this.Opid              = opid;
            this.Request           = request;
            this.Parent            = parent;
            this.StartingClock     = clock;
            this.LockedByCaller    = lockedByCaller;
            this.OrchestrationType = orchestrationType;
            this.History           = new List <Record>();
            this.Continuations     = new Dictionary <ulong, IContinuationInfo>();
            this.process           = process;
            this.info              = info;

            process.OrchestrationStates[opid] = this;
            StartOrResume();
        }