Beispiel #1
0
 public GraphModule(GraphAssembly assembly, Shape shape, Attributes attributes, IModule[] materializedValueIds)
 {
     Assembly             = assembly;
     Shape                = shape;
     Attributes           = attributes;
     MaterializedValueIds = materializedValueIds;
 }
Beispiel #2
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="assembly">TBD</param>
        /// <param name="materializer">TBD</param>
        /// <param name="log">TBD</param>
        /// <param name="logics">TBD</param>
        /// <param name="connections">TBD</param>
        /// <param name="onAsyncInput">TBD</param>
        /// <param name="fuzzingMode">TBD</param>
        /// <param name="context">TBD</param>
        public GraphInterpreter(
            GraphAssembly assembly,
            IMaterializer materializer,
            ILoggingAdapter log,
            GraphStageLogic[] logics,
            Connection[] connections,
            Action <GraphStageLogic, object, Action <object> > onAsyncInput,
            bool fuzzingMode,
            IActorRef context)
        {
            Logics       = logics;
            Assembly     = assembly;
            Materializer = materializer;
            Log          = log;
            Connections  = connections;
            OnAsyncInput = onAsyncInput;
            FuzzingMode  = fuzzingMode;
            Context      = context;

            RunningStagesCount = Assembly.Stages.Length;

            _shutdownCounter = new int[assembly.Stages.Length];
            for (var i = 0; i < _shutdownCounter.Length; i++)
            {
                var shape = assembly.Stages[i].Shape;
                _shutdownCounter[i] = shape.Inlets.Count() + shape.Outlets.Count();
            }

            _eventQueue = new Connection[1 << (32 - (assembly.ConnectionCount - 1).NumberOfLeadingZeros())];
            _mask       = _eventQueue.Length - 1;
        }
Beispiel #3
0
        public GraphInterpreter(
            GraphAssembly assembly,
            IMaterializer materializer,
            ILoggingAdapter log,
            IInHandler[] inHandlers,
            IOutHandler[] outHandlers,
            GraphStageLogic[] logics,
            Action <GraphStageLogic, object, Action <object> > onAsyncInput,
            bool fuzzingMode,
            IActorRef context)
        {
            Logics       = logics;
            Assembly     = assembly;
            Materializer = materializer;
            Log          = log;
            InHandlers   = inHandlers;
            OutHandlers  = outHandlers;
            OnAsyncInput = onAsyncInput;
            FuzzingMode  = fuzzingMode;
            Context      = context;

            ConnectionSlots = new object[assembly.ConnectionCount];
            for (var i = 0; i < ConnectionSlots.Length; i++)
            {
                ConnectionSlots[i] = Empty.Instance;
            }

            PortStates = new int[assembly.ConnectionCount];
            for (var i = 0; i < PortStates.Length; i++)
            {
                PortStates[i] = InReady;
            }

            RunningStagesCount = Assembly.Stages.Length;

            _shutdownCounter = new int[assembly.Stages.Length];
            for (var i = 0; i < _shutdownCounter.Length; i++)
            {
                var shape = assembly.Stages[i].Shape;
                _shutdownCounter[i] = shape.Inlets.Count() + shape.Outlets.Count();
            }

            _eventQueue = new int[1 << (32 - (assembly.ConnectionCount - 1).NumberOfLeadingZeros())];
            _mask       = _eventQueue.Length - 1;
        }
Beispiel #4
0
        public GraphInterpreterShell(GraphAssembly assembly, IInHandler[] inHandlers, IOutHandler[] outHandlers, GraphStageLogic[] logics, Shape shape, ActorMaterializerSettings settings, ActorMaterializerImpl materializer)
        {
            _assembly    = assembly;
            _inHandlers  = inHandlers;
            _outHandlers = outHandlers;
            _logics      = logics;
            _shape       = shape;
            _settings    = settings;
            Materializer = materializer;

            _inputs             = new ActorGraphInterpreter.BatchingActorInputBoundary[shape.Inlets.Count()];
            _outputs            = new ActorGraphInterpreter.IActorOutputBoundary[shape.Outlets.Count()];
            _subscribersPending = _inputs.Length;
            _publishersPending  = _outputs.Length;
            _shellEventLimit    = settings.MaxInputBufferSize * (assembly.Inlets.Length + assembly.Outlets.Length);
            _abortLimit         = _shellEventLimit * 2;

            _resume = new ActorGraphInterpreter.Resume(this);
        }