public static void Encode(ClientMessage clientMessage, Hazelcast.Data.MemberInfo memberInfo) { clientMessage.Append(Frame.CreateBeginStruct()); var initialFrame = new Frame(new byte[InitialFrameSize]); initialFrame.Bytes.WriteGuidL(UuidFieldOffset, memberInfo.Uuid); initialFrame.Bytes.WriteBoolL(LiteMemberFieldOffset, memberInfo.IsLiteMember); clientMessage.Append(initialFrame); AddressCodec.Encode(clientMessage, memberInfo.Address); MapCodec.Encode(clientMessage, memberInfo.Attributes, StringCodec.Encode, StringCodec.Encode); MemberVersionCodec.Encode(clientMessage, memberInfo.Version); MapCodec.Encode(clientMessage, memberInfo.AddressMap, EndpointQualifierCodec.Encode, AddressCodec.Encode); clientMessage.Append(Frame.CreateEndStruct()); }
public static Hazelcast.Data.MemberInfo Decode(IEnumerator <Frame> iterator) { // begin frame iterator.Take(); var initialFrame = iterator.Take(); var uuid = initialFrame.Bytes.ReadGuidL(UuidFieldOffset); var liteMember = initialFrame.Bytes.ReadBoolL(LiteMemberFieldOffset); var address = AddressCodec.Decode(iterator); var attributes = MapCodec.Decode(iterator, StringCodec.Decode, StringCodec.Decode); var version = MemberVersionCodec.Decode(iterator); var isAddressMapExists = false; IDictionary <Hazelcast.Data.EndpointQualifier, Hazelcast.Networking.NetworkAddress> addressMap = default; if (iterator.NextIsNotTheEnd()) { addressMap = MapCodec.Decode(iterator, EndpointQualifierCodec.Decode, AddressCodec.Decode); isAddressMapExists = true; } iterator.SkipToStructEnd(); return(new Hazelcast.Data.MemberInfo(address, uuid, attributes, liteMember, version, isAddressMapExists, addressMap)); }