Ejemplo n.º 1
0
        public static ClientMessage EncodeRequest(string name, Hazelcast.Protocol.Models.PagingPredicateHolder predicate)
        {
            var clientMessage = new ClientMessage
            {
                IsRetryable   = true,
                OperationName = "Map.ValuesWithPagingPredicate"
            };
            var initialFrame = new Frame(new byte[RequestInitialFrameSize], (FrameFlags)ClientMessageFlags.Unfragmented);

            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.MessageType, RequestMessageType);
            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.PartitionId, -1);
            clientMessage.Append(initialFrame);
            StringCodec.Encode(clientMessage, name);
            PagingPredicateHolderCodec.Encode(clientMessage, predicate);
            return(clientMessage);
        }
Ejemplo n.º 2
0
        public static void Encode(ClientMessage clientMessage, Hazelcast.Protocol.Models.PagingPredicateHolder pagingPredicateHolder)
        {
            clientMessage.Append(Frame.CreateBeginStruct());

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

            initialFrame.Bytes.WriteIntL(PageSizeFieldOffset, pagingPredicateHolder.PageSize);
            initialFrame.Bytes.WriteIntL(PageFieldOffset, pagingPredicateHolder.Page);
            initialFrame.Bytes.WriteByteL(IterationTypeIdFieldOffset, pagingPredicateHolder.IterationTypeId);
            clientMessage.Append(initialFrame);

            AnchorDataListHolderCodec.Encode(clientMessage, pagingPredicateHolder.AnchorDataListHolder);
            CodecUtil.EncodeNullable(clientMessage, pagingPredicateHolder.PredicateData, DataCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, pagingPredicateHolder.ComparatorData, DataCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, pagingPredicateHolder.PartitionKeyData, DataCodec.Encode);

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