Ejemplo n.º 1
0
        public static Hazelcast.Protocol.Models.PagingPredicateHolder Decode(IEnumerator <Frame> iterator)
        {
            // begin frame
            iterator.Take();

            var initialFrame = iterator.Take();
            var pageSize     = initialFrame.Bytes.ReadIntL(PageSizeFieldOffset);

            var page                 = initialFrame.Bytes.ReadIntL(PageFieldOffset);
            var iterationTypeId      = initialFrame.Bytes.ReadByteL(IterationTypeIdFieldOffset);
            var anchorDataListHolder = AnchorDataListHolderCodec.Decode(iterator);
            var predicateData        = CodecUtil.DecodeNullable(iterator, DataCodec.Decode);
            var comparatorData       = CodecUtil.DecodeNullable(iterator, DataCodec.Decode);
            var partitionKeyData     = CodecUtil.DecodeNullable(iterator, DataCodec.Decode);

            iterator.SkipToStructEnd();
            return(new Hazelcast.Protocol.Models.PagingPredicateHolder(anchorDataListHolder, predicateData, comparatorData, pageSize, page, iterationTypeId, partitionKeyData));
        }
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());
        }