Exemplo n.º 1
0
        public static ClientMessage EncodeResponse(Hazelcast.Data.HDictionaryEntry <IData, IData> response, long maxIdle)
        {
            var clientMessage = new ClientMessage();
            var initialFrame  = new Frame(new byte[ResponseInitialFrameSize], (FrameFlags)ClientMessageFlags.Unfragmented);

            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.MessageType, ResponseMessageType);
            initialFrame.Bytes.WriteLongL(ResponseMaxIdleFieldOffset, maxIdle);
            clientMessage.Append(initialFrame);
            CodecUtil.EncodeNullable(clientMessage, response, SimpleEntryViewCodec.Encode);
            return(clientMessage);
        }
Exemplo n.º 2
0
        public static void Encode(ClientMessage clientMessage, Hazelcast.Data.HDictionaryEntry <IData, IData> simpleEntryView)
        {
            clientMessage.Append(Frame.CreateBeginStruct());

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

            initialFrame.Bytes.WriteLongL(CostFieldOffset, simpleEntryView.Cost);
            initialFrame.Bytes.WriteLongL(CreationTimeFieldOffset, simpleEntryView.CreationTime);
            initialFrame.Bytes.WriteLongL(ExpirationTimeFieldOffset, simpleEntryView.ExpirationTime);
            initialFrame.Bytes.WriteLongL(HitsFieldOffset, simpleEntryView.Hits);
            initialFrame.Bytes.WriteLongL(LastAccessTimeFieldOffset, simpleEntryView.LastAccessTime);
            initialFrame.Bytes.WriteLongL(LastStoredTimeFieldOffset, simpleEntryView.LastStoredTime);
            initialFrame.Bytes.WriteLongL(LastUpdateTimeFieldOffset, simpleEntryView.LastUpdateTime);
            initialFrame.Bytes.WriteLongL(VersionFieldOffset, simpleEntryView.Version);
            initialFrame.Bytes.WriteLongL(TtlFieldOffset, simpleEntryView.Ttl);
            initialFrame.Bytes.WriteLongL(MaxIdleFieldOffset, simpleEntryView.MaxIdle);
            clientMessage.Append(initialFrame);

            DataCodec.Encode(clientMessage, simpleEntryView.Key);
            DataCodec.Encode(clientMessage, simpleEntryView.Value);

            clientMessage.Append(Frame.CreateEndStruct());
        }