Ejemplo n.º 1
0
        public static StateLogEntryRedirectRequest BiserDecode(byte[] enc = null, Biser.Decoder extDecoder = null) //!!!!!!!!!!!!!! change return type
        {
            Biser.Decoder decoder = null;
            if (extDecoder == null)
            {
                if (enc == null || enc.Length == 0)
                {
                    return(null);
                }
                decoder = new Biser.Decoder(enc);
                if (decoder.CheckNull())
                {
                    return(null);
                }
            }
            else
            {
                decoder = new Biser.Decoder(extDecoder);
                if (decoder.IsNull)
                {
                    return(null);
                }
            }

            StateLogEntryRedirectRequest m = new StateLogEntryRedirectRequest();  //!!!!!!!!!!!!!! change return type

            m.Data = decoder.GetByteArray();

            return(m);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// called from lock try..catch
        /// </summary>
        /// <param name="address"></param>
        /// <param name="data"></param>
        void ParseStateLogRedirectRequest(NodeAddress address, byte[] data)
        {
            StateLogEntryRedirectRequest req = StateLogEntryRedirectRequest.BiserDecode(data);

            //StateLogEntryRedirectResponse resp = new StateLogEntryRedirectResponse(); //{ RedirectId = req.RedirectId };

            if (this.NodeState != eNodeState.Leader)  //Just return
            {
                return;
            }

            this.NodeStateLog.AddStateLogEntryForDistribution(req.Data);//, redirectId);
            ApplyLogEntry();

            //Don't answer, committed value wil be delivered via standard channel
        }