public void MergeFrom(FaultDelay other)
        {
            if (other == null)
            {
                return;
            }
            if (other.Type != 0)
            {
                Type = other.Type;
            }
            if (other.Percent != 0)
            {
                Percent = other.Percent;
            }
            switch (other.FaultDelaySecifierCase)
            {
            case FaultDelaySecifierOneofCase.FixedDelay:
                if (FixedDelay == null)
                {
                    FixedDelay = new global::Google.Protobuf.WellKnownTypes.Duration();
                }
                FixedDelay.MergeFrom(other.FixedDelay);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Type != global::Envoy.Config.Filter.Fault.V3Alpha.FaultDelay.Types.FaultDelayType.Fixed)
            {
                hash ^= Type.GetHashCode();
            }
            if (faultDelaySecifierCase_ == FaultDelaySecifierOneofCase.FixedDelay)
            {
                hash ^= FixedDelay.GetHashCode();
            }
            if (faultDelaySecifierCase_ == FaultDelaySecifierOneofCase.HeaderDelay)
            {
                hash ^= HeaderDelay.GetHashCode();
            }
            if (percentage_ != null)
            {
                hash ^= Percentage.GetHashCode();
            }
            hash ^= (int)faultDelaySecifierCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 3
0
 public FixedDelayProvider()
 {
     _intContainer = new FixedDelay(fixedDelay: 1000, fixedDelayMin: 10)
     {
         Delay = 1000
     };
 }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World! TEST REGULATE");

            One2OneChannel a = Channel.createOne2One();
            One2OneChannel b = Channel.createOne2One();
            One2OneChannel c = Channel.createOne2One();

            One2OneChannel reset = Channel.createOne2One(new OverWriteOldestBuffer(1));

            Numbers      num        = new Numbers(a.Out());
            FixedDelay   fixedDelay = new FixedDelay(250, a.In(), b.Out());
            Regulate     regulate   = new Regulate(b.In(), reset.In(), c.Out(), 1000);
            LoopsProcess loops      = new LoopsProcess(c.In(), reset.Out());

            IamCSProcess[] network = { num, fixedDelay, regulate, loops };

            new CSPParallel(network).run();
            Console.ReadKey();
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            One2OneChannel data       = Channel.one2one();
            One2OneChannel timedData  = Channel.one2one();
            One2OneChannel scaledData = Channel.one2one();
            One2OneChannel oldScale   = Channel.one2one();
            One2OneChannel newScale   = Channel.one2one();
            One2OneChannel pause      = Channel.one2one();

            Numbers num = new Numbers(data.Out());

            FixedDelay fixedDelay = new FixedDelay(1000,
                                                   data.In(),
                                                   timedData.Out());

            Scale scale = new Scale(inChannel: timedData.In(),
                                    outChannel: scaledData.Out(),
                                    factor: oldScale.Out(),
                                    suspend: pause.In(),
                                    injector: newScale.In(),
                                    multiplier: 2,
                                    scaling: 2);

            Controller controller = new Controller(testInterval: 11000,
                                                   computeInterval: 3000,
                                                   addition: 1,
                                                   factor: oldScale.In(),
                                                   suspend: pause.Out(),
                                                   injector: newScale.Out());

            GPrint gPrint = new GPrint(inChannel: scaledData.In(),
                                       heading: "Scaled_Data",
                                       delay: 1000);

            IamCSProcess[] network = { num, fixedDelay, scale, controller, gPrint };

            new CSPParallel(network).run();

            Console.ReadKey();
        }
        public void MergeFrom(FaultDelay other)
        {
            if (other == null)
            {
                return;
            }
            if (other.Type != global::Envoy.Config.Filter.Fault.V3Alpha.FaultDelay.Types.FaultDelayType.Fixed)
            {
                Type = other.Type;
            }
            if (other.percentage_ != null)
            {
                if (percentage_ == null)
                {
                    Percentage = new global::Envoy.Type.FractionalPercent();
                }
                Percentage.MergeFrom(other.Percentage);
            }
            switch (other.FaultDelaySecifierCase)
            {
            case FaultDelaySecifierOneofCase.FixedDelay:
                if (FixedDelay == null)
                {
                    FixedDelay = new global::Google.Protobuf.WellKnownTypes.Duration();
                }
                FixedDelay.MergeFrom(other.FixedDelay);
                break;

            case FaultDelaySecifierOneofCase.HeaderDelay:
                if (HeaderDelay == null)
                {
                    HeaderDelay = new global::Envoy.Config.Filter.Fault.V3Alpha.FaultDelay.Types.HeaderDelay();
                }
                HeaderDelay.MergeFrom(other.HeaderDelay);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (Percent != 0)
            {
                hash ^= Percent.GetHashCode();
            }
            if (faultDelaySecifierCase_ == FaultDelaySecifierOneofCase.FixedDelay)
            {
                hash ^= FixedDelay.GetHashCode();
            }
            hash ^= (int)faultDelaySecifierCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 8
0
        /// <summary>
        /// Flow stage with fixed delay for each element.
        /// </summary>
        /// <param name="fixedDelay">value of the delay</param>
        public DelayFlow(TimeSpan fixedDelay)
        {
            var delayStrategy = new FixedDelay <T>(fixedDelay);

            _strategySupplier = () => delayStrategy;
        }