/// <summary>
        /// 客户端下线处理 callback
        /// </summary>
        /// <param name="ClientID">客户端ID</param>
        public void ClientDisconnect(object sender, ClientEventArg arg)
        {
            string ClientID = arg.ClientID;

            LOG.Error(string.Format("客户端:{0}下线", ClientID));

            Redundancy _redundancy = ResourceManager.GetRedundancy();

            _redundancy.OnDisconnectFromPartner();
        }
        public void ConnectResourceHost(string ClientID)
        {
            //LOG.Debug(string.Format("冗余伙伴{0}连接上线.", ClientID));

            string ClientHostName = OperationContext.Current.Channel.RemoteAddress.ToString();

            _hbManager.AddClient(ClientID);

            Redundancy _redundancy = ResourceManager.GetRedundancy();

            _redundancy.OnConnectFromPartner();
        }
Example #3
0
        public void RedundancyEqualsZero()
        {
            var a = ActorHelper.Get(2);
            var e = new List <Edge>
            {
                new Edge(a[0], a[1])
            };
            var l0 = new Layer(e);
            var l1 = new Layer();
            var l  = new List <Layer> {
                l0, l1
            };
            var n = new Network(l, a);
            var c = new Community(a);

            var r = Redundancy.Compute(c, n);

            Assert.Equal(0.0, r);
        }
        /// <summary>
        /// "Prunes the PO-Log once an operation is causally delivered in the effect. The aim is to
        /// keep the smallest number of PO-Log operations such that all queries return
        /// the same result as if the full PO-Log was present. In particular, this method discards
        /// operations from the PO-Log if they can be removed without impacting the output of query
        /// operations"
        /// These is called causal redundancy and it is one of the two mechanisms that conforms the semantic
        /// compaction used by the framework to reduce the size of pure op-based CRDTs. The other one is causal
        /// stabilization through <see cref="Stable(VectorTime)"/>.
        /// </summary>
        /// <param name="ops">The set of operations that conform the POLog.</param>
        /// <param name="newOperation">The new delivered operation.</param>
        /// <param name="r">A function that receives a new operation o and returns a filter that returns true if an operation o' is redundant by o.</param>
        /// <returns>The set of operations that conform the POLog and are not redundant by <paramref name="newOperation"/>.</returns>
        public ImmutableHashSet <Versioned <object> > Prune(ImmutableHashSet <Versioned <object> > ops, Versioned <object> newOperation, Redundancy r)
        {
            var builder = ops.ToBuilder();

            foreach (var op in ops)
            {
                if (r(newOperation, op))
                {
                    builder.Remove(op);
                }
            }
            return(builder.ToImmutable());
        }
        public void ExchangeData(string ResourceName, string ExchangeData)
        {
            Redundancy _redundancy = ResourceManager.GetRedundancy();

            _redundancy.OnDataSyncFromPartner(ResourceName, ExchangeData);
        }
        public Int16 GetPartnerMode()
        {
            Redundancy _redundancy = ResourceManager.GetRedundancy();

            return(Convert.ToInt16(_redundancy.Mode));
        }
        //public void TogglePartnerMode()
        //{
        //    Redundancy _redundancy = ResourceManager.GetRedundancy();
        //    _redundancy.TogglePartnerMode();
        //}



        public long GetPartnerRunTime()
        {
            Redundancy _redundancy = ResourceManager.GetRedundancy();

            return(Convert.ToInt64(_redundancy.RunTime));
        }
Example #8
0
        public void CheckRedundancyInRules()
        {
            RedundancyMethod delegateMethod = new RedundancyMethod(Redundancy.CheckRedundancyWithRules);

            Redundancy.GeneralCheckRedundancyMethod(_bases, delegateMethod);
        }
Example #9
0
        public void CheckConstrainsRedundancy()
        {
            var delegateMethod = new RedundancyMethod(Redundancy.CheckRedundancyWithConstrain);

            Redundancy.GeneralCheckRedundancyMethod(_bases, delegateMethod);
        }
Example #10
0
        public void ToggleRedundancyMode()
        {
            Redundancy _redundancy = ResourceManager.GetRedundancy();

            _redundancy.TogglePartnerMode();
        }
Example #11
0
 public CausalRedundancy(LogRedundancy r, Redundancy r0, Redundancy r1 = null)
 {
     R  = r;
     R0 = r0;
     R1 = r1 ?? r0;
 }
Example #12
0
 public void RedundancyTest()
 {
     Assert.IsTrue(Redundancy.License.Licensed);
     Assert.AreEqual(Redundancy.License.Volume, 2);
     Redundancy.CheckIfAllowed(2, "test name");
 }