Esempio n. 1
0
        internal void RenderFastForward(
            bool render,
            Block <T> oldTip,
            Block <T> newTip,
            Block <T> branchpoint,
            IReadOnlyList <Block <T> > fastForwardPath,
            StateCompleterSet <T> stateCompleters)
        {
            if (render && ActionRenderers.Any())
            {
                _logger.Debug("Rendering actions in new chain.");

                long count = 0;
                foreach (Block <T> block in fastForwardPath)
                {
                    ImmutableList <ActionEvaluation> evaluations =
                        ActionEvaluator.Evaluate(block, stateCompleters).ToImmutableList();

                    count += RenderActions(
                        evaluations: evaluations,
                        block: block,
                        stateCompleters: stateCompleters);
                }

                _logger.Debug(
                    $"{nameof(Swap)}() completed rendering {{Count}} actions.",
                    count);

                foreach (IActionRenderer <T> renderer in ActionRenderers)
                {
                    renderer.RenderBlockEnd(oldTip, newTip);
                }
            }
        }
Esempio n. 2
0
        internal void RenderRewind(
            bool render,
            Block <T> oldTip,
            Block <T> newTip,
            Block <T> branchpoint,
            IReadOnlyList <Block <T> > rewindPath,
            StateCompleterSet <T> stateCompleters)
        {
            if (render && ActionRenderers.Any())
            {
                // Unrender stale actions.
                _logger.Debug("Unrendering abandoned actions...");

                long count = 0;

                foreach (Block <T> block in rewindPath)
                {
                    ImmutableList <ActionEvaluation> evaluations =
                        ActionEvaluator.Evaluate(block, stateCompleters)
                        .ToImmutableList().Reverse();

                    count += UnrenderActions(
                        evaluations: evaluations,
                        block: block,
                        stateCompleters: stateCompleters);
                }

                _logger.Debug(
                    $"{nameof(Swap)}() completed unrendering {{Actions}} actions.",
                    count);
            }
        }