Example #1
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="connection">TBD</param>
 /// <param name="remoteAddress">TBD</param>
 /// <param name="halfClose">TBD</param>
 public IncomingConnectionStage(IActorRef connection, EndPoint remoteAddress, bool halfClose)
 {
     _connection    = connection;
     _remoteAddress = remoteAddress;
     _halfClose     = halfClose;
     Shape          = new FlowShape <ByteString, ByteString>(_bytesIn, _bytesOut);
 }
Example #2
0
        public MyBuffer(int n, float selectionFactor)
        {
            _size            = n;
            _selectionFactor = selectionFactor;

            Shape = new FlowShape <T, T>(In, Out);
        }
Example #3
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="maxSubstreams">TBD</param>
        /// <param name="keyFor">TBD</param>
        public GroupBy(int maxSubstreams, Func <T, TKey> keyFor)
        {
            _maxSubstreams = maxSubstreams;
            _keyFor        = keyFor;

            Shape = new FlowShape <T, Source <T, NotUsed> >(In, Out);
        }
Example #4
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="breadth">TBD</param>
        public FlattenMerge(int breadth)
        {
            _breadth = breadth;

            InitialAttributes = DefaultAttributes.FlattenMerge;
            Shape             = new FlowShape <TGraph, T>(_in, _out);
        }
Example #5
0
 public KeyAccumulator(Func <TIn, TKey> keySelector, Predicate <IEnumerable <TIn> > flushWhen, Func <IEnumerable <TIn>, TOut> mapper)
 {
     _keySelector = keySelector;
     _flushWhen   = flushWhen;
     _mapper      = mapper;
     Shape        = new FlowShape <TIn, TOut>(In, Out);
 }
Example #6
0
        public void CreateRularNode(string name, double width, double height, double offsetX, double offsetY, string text, FlowShapes shape, DiagramProperties model)
        {
            FlowShape node = new FlowShape();

            node.Name    = name;
            node.Width   = width;
            node.Height  = height;
            node.OffsetX = offsetX;
            node.OffsetY = offsetY;
            if (node.Name == "Decision")
            {
                node.FillColor   = "#858585";
                node.BorderColor = "#858585";
            }
            else
            {
                node.FillColor   = "#1BA0E2";
                node.BorderColor = "#1BA0E2";
            }
            node.Type  = Shapes.Flow;
            node.Shape = shape;
            node.Labels.Add(new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label {
                Text = text, FontColor = "white"
            });
            model.Nodes.Add(node);
        }
Example #7
0
 public FlowLayoutSource()
 {
     FlowShape = FlowShape.Circle;
     Width = 300;
     Height = 300;
     Reset();
 }
Example #8
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="shape">TBD</param>
        /// <param name="attributes">TBD</param>
        /// <param name="stage">TBD</param>
        public PushPullGraphLogic(
            FlowShape <TIn, TOut> shape,
            Attributes attributes,
            AbstractStage <TIn, TOut> stage)
            : base(shape)
        {
            Attributes    = attributes;
            _currentStage = Stage = stage;
            _shape        = shape;

            SetHandler(_shape.Inlet, onPush: () =>
            {
                try
                {
                    _currentStage.OnPush(Grab(_shape.Inlet), Context);
                }
                catch (Exception e)
                {
                    OnSupervision(e);
                }
            },
                       onUpstreamFailure: exception => _currentStage.OnUpstreamFailure(exception, Context),
                       onUpstreamFinish: () => _currentStage.OnUpstreamFinish(Context));

            SetHandler(_shape.Outlet,
                       onPull: () => _currentStage.OnPull(Context),
                       onDownstreamFinish: () => _currentStage.OnDownstreamFinish(Context));
        }
Example #9
0
        /// <summary>
        /// Internal API: Converts incoming <see cref="ImmutableList{ByteString}"/> to <see cref="Dictionary{string, ByteString}"/>
        /// </summary>
        /// <param name="columnNames">If given, these names are used as map keys; if not first stream element is used</param>
        /// <param name="encoding">Character encoding used to convert header line ByteString to String</param>
        public CsvToDictionaryStage(ImmutableList <string> columnNames, Encoding encoding)
        {
            _columnNames = columnNames;
            _encoding    = encoding;

            Shape = new FlowShape <ImmutableList <ByteString>, Dictionary <string, ByteString> >(In, Out);
        }
Example #10
0
        private FlowShape CreateFlowShape(String name, FlowShapes shape, double width, double height, double offsetx, double offsety, string labelText, DiagramProperties model, bool addPorts = false)
        {
            FlowShape node = new FlowShape();

            node.Name        = name;
            node.Width       = width;
            node.Shape       = shape;
            node.Height      = height;
            node.OffsetX     = offsetx;
            node.BorderColor = "#000000";
            node.FillColor   = "#6bbd45";
            node.OffsetY     = offsety;
            node.Constraints = NodeConstraints.Default & ~NodeConstraints.Drag;
            Label label = new Label();

            label.Margin = new LabelMargin()
            {
                Bottom = 2, Top = 2, Left = 20, Right = 20
            };
            label.Text      = labelText;
            label.FontColor = "white";
            label.Name      = name + "_label";
            node.Labels.Add(label);
            if (addPorts)
            {
                AddPorts(node);
            }
            model.Nodes.Add(node);
            return(node);
        }
Example #11
0
 public Detacher()
 {
     InitialAttributes = Attributes.CreateName("Detacher");
     Inlet             = new Inlet <T>("in");
     Outlet            = new Outlet <T>("out");
     Shape             = new FlowShape <T, T>(Inlet, Outlet);
 }
Example #12
0
        private FlowShape CreateFlowShape(String name, FlowShapes shape, double width, double height, double offsetx, double offsety, string color, string labelText, Collection nodes, bool addPorts = false)
        {
            FlowShape node = new FlowShape();

            node.Name        = name;
            node.Width       = width;
            node.Shape       = shape;
            node.Height      = height;
            node.OffsetX     = offsetx;
            node.FillColor   = color;
            node.BorderColor = "#000000";
            node.OffsetY     = offsety;
            Label label = new Label();

            label.Margin = new LabelMargin()
            {
                Bottom = 2, Top = 2, Left = 20, Right = 20
            };
            label.Text      = labelText;
            label.FontColor = "white";
            label.Name      = name + "_label";
            node.Labels.Add(label);
            if (addPorts)
            {
                AddPorts(node);
            }
            nodes.Add(node);
            return(node);
        }
Example #13
0
 /// <summary>
 /// TBD
 /// </summary>
 protected SimpleLinearGraphStage(string name = null)
 {
     name   = name ?? GetType().Name;
     Inlet  = new Inlet <T>(name + ".in");
     Outlet = new Outlet <T>(name + ".out");
     Shape  = new FlowShape <T, T>(Inlet, Outlet);
 }
Example #14
0
 public FlowLayoutSource()
 {
     FlowShape = FlowShape.Circle;
     Width     = 300;
     Height    = 300;
     Reset();
 }
Example #15
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="timeout">TBD</param>
        /// <param name="inject">TBD</param>
        public IdleInject(TimeSpan timeout, Func <TOut> inject)
        {
            _timeout = timeout;
            _inject  = inject;

            Shape = new FlowShape <TIn, TOut>(_in, _out);
        }
Example #16
0
 public AmqpRpcFlowStage(AmqpSinkSettings settings, int bufferSize, int responsePerMessage = 1)
 {
     Settings           = settings;
     BufferSize         = bufferSize;
     ResponsePerMessage = responsePerMessage;
     Shape = new FlowShape <OutgoingMessage, IncomingMessage>(In, Out);
 }
Example #17
0
        internal CsvParsingStage(byte delimiter, byte quoteChar, byte escapeChar)
        {
            _delimiter  = delimiter;
            _quoteChar  = quoteChar;
            _escapeChar = escapeChar;

            Shape = new FlowShape <ByteString, ImmutableList <ByteString> >(In, Out);
        }
        /// <summary>
        /// TransactionalProducerStage
        /// </summary>
        public TransactionalProducerStage(bool closeProducerOnStop, ProducerSettings <K, V> settings)
        {
            _settings = settings;

            CloseProducerOnStop = closeProducerOnStop;
            ProducerProvider    = errorHandler => _settings.CreateKafkaProducer(errorHandler);
            Shape = new FlowShape <IEnvelope <K, V, TPassThrough>, Task <IResults <K, V, TPassThrough> > >(In, Out);
        }
Example #19
0
        /// <summary>
        /// Creates <see cref="Valve{T}"/> with inital <paramref name="mode"/>
        /// </summary>
        /// <param name="mode">state of the valve at the startup of the flow</param>
        public Valve(SwitchMode mode)
        {
            _mode = mode;

            In    = new Inlet <T>("valve.in");
            Out   = new Outlet <T>("valve.out");
            Shape = new FlowShape <T, T>(In, Out);
        }
Example #20
0
        /// <param name="next">a lambda returns next sample position</param>
        public Sample(Func <int> next)
        {
            _next = next;

            In    = new Inlet <T>("Sample-in");
            Out   = new Outlet <T>("Sample-out");
            Shape = new FlowShape <T, T>(In, Out);
        }
Example #21
0
            public DelimiterFramingStage(ByteString separatorBytes, int maximumLineBytes, bool allowTruncation)
            {
                _separatorBytes   = separatorBytes;
                _maximumLineBytes = maximumLineBytes;
                _allowTruncation  = allowTruncation;

                Shape = new FlowShape <ByteString, ByteString>(In, Out);
            }
Example #22
0
        /// <summary>
        /// TBD
        /// </summary>
        protected SimpleLinearGraphStage()
        {
            var name = GetType().Name;

            Inlet  = new Inlet <T>(name + ".in");
            Outlet = new Outlet <T>(name + ".out");
            Shape  = new FlowShape <T, T>(Inlet, Outlet);
        }
Example #23
0
 public LmdbArchiveStage(string databaseName, Func <LMDBEnvironment> lmdbEnvFactory)
 {
     this.lmdbEnvFactory = lmdbEnvFactory;
     this.databaseName   = databaseName;
     Inlet  = new Inlet <Command <T> >("lmdb-archive.in");
     Outlet = new Outlet <Emission <T> >("lmdb-archive.out");
     Shape  = new FlowShape <Command <T>, Emission <T> >(Inlet, Outlet);
 }
        /// <param name="propertyExtractor">a function to extract the observed element property</param>
        public AccumulateWhileUnchanged(Func <TElement, TProperty> propertyExtractor)
        {
            _propertyExtractor = propertyExtractor;

            In    = new Inlet <TElement>("AccumulateWhileUnchanged.in");
            Out   = new Outlet <IEnumerable <TElement> >("AccumulateWhileUnchanged.out");
            Shape = new FlowShape <TElement, IEnumerable <TElement> >(In, Out);
        }
Example #25
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="factory">TBD</param>
        /// <param name="stageAttributes">TBD</param>
        public PushPullGraphStageWithMaterializedValue(Func <Attributes, Tuple <IStage <TIn, TOut>, TMat> > factory, Attributes stageAttributes)
        {
            InitialAttributes = stageAttributes;
            Factory           = factory;

            var name = stageAttributes.GetNameOrDefault();

            Shape = new FlowShape <TIn, TOut>(new Inlet <TIn>(name + ".in"), new Outlet <TOut>(name + ".out"));
        }
 public CloseConnectionGraphStage(
     Inlet <string> inlet,
     Outlet <string> outlet)
 {
     Inlet  = inlet;
     Outlet = outlet;
     Shape  = new FlowShape <string, string>(inlet,
                                             outlet);
 }
Example #27
0
 public ProducerStage(
     ProducerSettings <K, V> settings,
     bool closeProducerOnStop,
     Func <IProducer <K, V> > producerProvider)
 {
     Settings            = settings;
     CloseProducerOnStop = closeProducerOnStop;
     ProducerProvider    = producerProvider;
     Shape = new FlowShape <MessageAndMeta <K, V>, Task <DeliveryReport <K, V> > >(In, Out);
 }
Example #28
0
 public RestartWithBackoffFlow(
     Func <Flow <TIn, TOut, TMat> > flowFactory,
     RestartSettings settings,
     bool onlyOnFailures)
 {
     FlowFactory    = flowFactory;
     Settings       = settings;
     OnlyOnFailures = onlyOnFailures;
     Shape          = new FlowShape <TIn, TOut>(In, Out);
 }
Example #29
0
        public StreamingXmlParser(int bufferSize)
        {
            if (bufferSize < 64)
            {
                throw new ArgumentException($"Buffer size must be greater than 64 (was:{bufferSize})");
            }

            Shape       = new FlowShape <ByteString, IParseEvent>(In, Out);
            _bufferSize = bufferSize;
        }
Example #30
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="tcpManager">TBD</param>
 /// <param name="remoteAddress">TBD</param>
 /// <param name="localAddress">TBD</param>
 /// <param name="options">TBD</param>
 /// <param name="halfClose">TBD</param>
 /// <param name="connectionTimeout">TBD</param>
 public OutgoingConnectionStage(IActorRef tcpManager, EndPoint remoteAddress, EndPoint localAddress = null,
                                IImmutableList <Inet.SocketOption> options = null, bool halfClose = true, TimeSpan?connectionTimeout = null)
 {
     _tcpManager        = tcpManager;
     _remoteAddress     = remoteAddress;
     _localAddress      = localAddress;
     _options           = options;
     _halfClose         = halfClose;
     _connectionTimeout = connectionTimeout;
     Shape = new FlowShape <ByteString, ByteString>(_bytesIn, _bytesOut);
 }
        public DefaultProducerStage(
            ProducerSettings <K, V> settings,
            bool closeProducerOnStop,
            Func <IProducer <K, V> > customProducerProvider = null)
        {
            ProducerProvider    = errorHandler => customProducerProvider?.Invoke() ?? Settings.CreateKafkaProducer(errorHandler);
            Settings            = settings;
            CloseProducerOnStop = closeProducerOnStop;

            Shape = new FlowShape <TIn, Task <TOut> >(In, Out);
        }
Example #32
0
 private void SetLayoutShape(FlowShape flowShape)
 {
     flowLayoutSource.FlowShape = flowShape;
     flowLayoutSource.Reset();
 }