Beispiel #1
0
        public static RequestParameters DecodeRequest(ClientMessage clientMessage)
        {
            using var iterator = clientMessage.GetEnumerator();
            var request = new RequestParameters();

            iterator.Take(); // empty initial frame
            request.Name        = StringCodec.Decode(iterator);
            request.IndexConfig = IndexConfigCodec.Decode(iterator);
            return(request);
        }
Beispiel #2
0
        public static ClientMessage EncodeRequest(string name, Hazelcast.Config.IndexConfig indexConfig)
        {
            var clientMessage = CreateForEncode();

            clientMessage.IsRetryable   = false;
            clientMessage.OperationName = "Map.AddIndex";
            var initialFrame = new Frame(new byte[RequestInitialFrameSize], UnfragmentedMessage);

            EncodeInt(initialFrame.Content, TypeFieldOffset, RequestMessageType);
            EncodeInt(initialFrame.Content, PartitionIdFieldOffset, -1);
            clientMessage.Add(initialFrame);
            StringCodec.Encode(clientMessage, name);
            IndexConfigCodec.Encode(clientMessage, indexConfig);
            return(clientMessage);
        }
Beispiel #3
0
        public static ClientMessage EncodeRequest(string name, Hazelcast.Models.IndexOptions indexConfig)
        {
            var clientMessage = new ClientMessage
            {
                IsRetryable   = false,
                OperationName = "Map.AddIndex"
            };
            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);
            IndexConfigCodec.Encode(clientMessage, indexConfig);
            return(clientMessage);
        }