private Get GetFromBinary(byte[] bytes)
        {
            var proto   = Proto.Msg.Get.Parser.ParseFrom(bytes);
            var key     = (IKey)_ser.OtherMessageFromProto(proto.Key);
            var request = proto.Request != null?_ser.OtherMessageFromProto(proto.Request) : null;

            var timeout = new TimeSpan(proto.Timeout * TimeSpan.TicksPerMillisecond);
            var minCap  = proto.HasConsistencyMinCap ? proto.ConsistencyMinCap : 0;
            IReadConsistency consistency;

            switch (proto.Consistency)
            {
            case 0:
                if (proto.HasConsistencyAdditional)
                {
                    consistency = new ReadMajorityPlus(timeout, proto.ConsistencyAdditional, minCap);
                }
                else
                {
                    consistency = new ReadMajority(timeout, minCap);
                }
                break;

            case -1: consistency = new ReadAll(timeout); break;

            case 1: consistency = ReadLocal.Instance; break;

            default: consistency = new ReadFrom(proto.Consistency, timeout); break;
            }
            return(new Get(key, consistency, request));
        }
Beispiel #2
0
        public void Inicializar(ReadAll metodoDataSource, string textField, string valueField)
        {
            this.cmbEntidad.TextField  = textField;
            this.cmbEntidad.ValueField = valueField;
            this.cmbEntidad.DataSource = metodoDataSource("");

            this.cmbEntidad.DataBind();
        }
Beispiel #3
0
        public bool ReceiveAllMeasValue(TypeOfSCADACommand typeOfCommand)
        {
            Command c = MappingEngine.Instance.MappCommand(typeOfCommand);

            if (c != null)
            {
                ReadAll     ra     = (ReadAll)c;
                SCADAClient client = new SCADAClient();
                client.ExecuteCommand(ra);
                return(true);
            }
            else
            {
                ///logovati
                return(false);
            }
        }
Beispiel #4
0
        public ReplicatorSpec(ReplicatorSpecConfig config)
            : base(config)
        {
            _config  = config;
            _cluster = Cluster.Cluster.Get(Sys);
            var settings = ReplicatorSettings.Create(Sys).WithGossipInterval(TimeSpan.FromSeconds(1.0)).WithMaxDeltaElements(10);
            var props    = Replicator.Props(settings);

            _replicator = Sys.ActorOf(props, "replicator");

            _timeOut       = Dilated(TimeSpan.FromSeconds(2.0));
            _writeTwo      = new WriteTo(2, _timeOut);
            _writeMajority = new WriteMajority(_timeOut);
            _writeAll      = new WriteAll(_timeOut);
            _readTwo       = new ReadFrom(2, _timeOut);
            _readMajority  = new ReadMajority(_timeOut);
            _readAll       = new ReadAll(_timeOut);
        }
Beispiel #5
0
        protected ReplicatorSpec(ReplicatorSpecConfig config)
            : base(config, typeof(ReplicatorSpec))
        {
            _config  = config;
            _first   = config.First;
            _second  = config.Second;
            _third   = config.Third;
            _cluster = Akka.Cluster.Cluster.Get(Sys);
            var settings = ReplicatorSettings.Create(Sys)
                           .WithGossipInterval(TimeSpan.FromSeconds(1.0))
                           .WithMaxDeltaElements(10);
            var props = Replicator.Props(settings);

            _replicator = Sys.ActorOf(props, "replicator");

            _timeOut       = Dilated(TimeSpan.FromSeconds(3.0));
            _writeTwo      = new WriteTo(2, _timeOut);
            _writeMajority = new WriteMajority(_timeOut);
            _writeAll      = new WriteAll(_timeOut);
            _readTwo       = new ReadFrom(2, _timeOut);
            _readMajority  = new ReadMajority(_timeOut);
            _readAll       = new ReadAll(_timeOut);
        }
Beispiel #6
0
        public ReplicatorSpecs(ITestOutputHelper helper) : base(SpecConfig, helper)
        {
            _sys1 = Sys;
            _sys3 = ActorSystem.Create(Sys.Name, Sys.Settings.Config);
            _sys2 = ActorSystem.Create(Sys.Name, Sys.Settings.Config);

            _timeOut       = Dilated(TimeSpan.FromSeconds(3.0));
            _writeTwo      = new WriteTo(2, _timeOut);
            _writeMajority = new WriteMajority(_timeOut);
            _writeAll      = new WriteAll(_timeOut);
            _readTwo       = new ReadFrom(2, _timeOut);
            _readMajority  = new ReadMajority(_timeOut);
            _readAll       = new ReadAll(_timeOut);

            var settings = ReplicatorSettings.Create(Sys)
                           .WithGossipInterval(TimeSpan.FromSeconds(1.0))
                           .WithMaxDeltaElements(10);

            var props = Replicator.Props(settings);

            _replicator1 = _sys1.ActorOf(props, "replicator");
            _replicator2 = _sys2.ActorOf(props, "replicator");
            _replicator3 = _sys3.ActorOf(props, "replicator");
        }
        public void TestCommandMethod()
        {
            ReadAll comm = new ReadAll();

            Assert.AreEqual(MappingEngine.Instance.MappCommand(TypeOfSCADACommand.ReadAll).GetType(), comm.GetType());
        }
        public void Inicializar(ReadAll metodoDataSource, string textField, string valueField)
        {
            this.cmbEntidad.TextField  = textField;
            this.cmbEntidad.ValueField = valueField;
            this.cmbEntidad.DataSource = metodoDataSource("");

            this.cmbEntidad.DataBind();
        }