Ejemplo n.º 1
0
        public static void Encode(ClientMessage clientMessage, Hazelcast.Core.MemberInfo memberInfo)
        {
            clientMessage.Add(BeginFrame.Copy());

            var initialFrame = new Frame(new byte[InitialFrameSize]);

            EncodeGuid(initialFrame.Content, UuidFieldOffset, memberInfo.Uuid);
            EncodeBool(initialFrame.Content, LiteMemberFieldOffset, memberInfo.IsLiteMember);
            clientMessage.Add(initialFrame);

            AddressCodec.Encode(clientMessage, memberInfo.Address);
            MapCodec.Encode(clientMessage, memberInfo.Attributes, StringCodec.Encode, StringCodec.Encode);
            MemberVersionCodec.Encode(clientMessage, memberInfo.Version);

            clientMessage.Add(EndFrame.Copy());
        }
Ejemplo n.º 2
0
        public static Hazelcast.Core.MemberInfo Decode(FrameIterator iterator)
        {
            // begin frame
            iterator.Next();

            var initialFrame = iterator.Next();
            var uuid         = DecodeGuid(initialFrame.Content, UuidFieldOffset);
            var liteMember   = DecodeBool(initialFrame.Content, LiteMemberFieldOffset);

            var address    = AddressCodec.Decode(iterator);
            var attributes = MapCodec.Decode(iterator, StringCodec.Decode, StringCodec.Decode);
            var version    = MemberVersionCodec.Decode(iterator);

            CodecUtil.FastForwardToEndFrame(iterator);

            return(new Hazelcast.Core.MemberInfo(address, uuid, attributes, liteMember, version));
        }