Example #1
0
        public static OpPutResponse fromBytes(List <byte> list)
        {
            OpPutResponse newResp = new OpPutResponse();
            ulong         pos     = 0;

            newResp.header          = HeaderResponse.fromBytes(list, ref pos);
            newResp.responseStatus  = list[(int)pos++];
            newResp.prevValueLength = HotRodUtils.bytesToULong(list, ref pos);
            if (newResp.prevValueLength != 0)
            {
                newResp.prevValue = list.GetRange((int)pos, (int)(newResp.prevValueLength));
                pos += newResp.prevValueLength;
            }
            return(newResp);
        }
Example #2
0
        public static HashAwareTopologyInfo fromBytes(List <Byte> bytes, ref ulong pos)
        {
            HashAwareTopologyInfo resp = new HashAwareTopologyInfo();
            ulong numNodes;

            resp.topologyId = HotRodUtils.bytesToVLong(bytes, ref pos);
            numNodes        = HotRodUtils.bytesToVLong(bytes, ref pos);
            resp.nodes      = new List <HashAwareNodeAddress>((int)numNodes);
            for (uint i = 0; i < numNodes; i++)
            {
                ulong  addressLength = HotRodUtils.bytesToVLong(bytes, ref pos);
                string address       = Encoding.UTF8.GetString(bytes.GetRange((int)pos, (int)addressLength).ToArray());
                pos += addressLength;
                ushort port     = HotRodUtils.bytesToUShort(bytes, ref pos);
                ulong  hashcode = HotRodUtils.bytesToULong(bytes, ref pos);
                resp.nodes.Add(new HashAwareNodeAddress(address, port, hashcode));
            }
            return(resp);
        }