public static void Encode(ClientMessage clientMessage, Hazelcast.Config.IndexConfig indexConfig)
        {
            clientMessage.Add(BeginFrame.Copy());

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

            EncodeInt(initialFrame.Content, TypeFieldOffset, indexConfig.Type);
            clientMessage.Add(initialFrame);

            CodecUtil.EncodeNullable(clientMessage, indexConfig.Name, StringCodec.Encode);
            ListMultiFrameCodec.Encode(clientMessage, indexConfig.Attributes, StringCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, indexConfig.BitmapIndexOptions, BitmapIndexOptionsCodec.Encode);

            clientMessage.Add(EndFrame.Copy());
        }
        public static ClientMessage EncodeResponse(byte status, Hazelcast.Networking.NetworkAddress address, Guid memberUuid, byte serializationVersion, string serverHazelcastVersion, int partitionCount, Guid clusterId, bool failoverSupported)
        {
            var clientMessage = new ClientMessage();
            var initialFrame  = new Frame(new byte[ResponseInitialFrameSize], (FrameFlags)ClientMessageFlags.Unfragmented);

            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.MessageType, ResponseMessageType);
            initialFrame.Bytes.WriteByteL(ResponseStatusFieldOffset, status);
            initialFrame.Bytes.WriteGuidL(ResponseMemberUuidFieldOffset, memberUuid);
            initialFrame.Bytes.WriteByteL(ResponseSerializationVersionFieldOffset, serializationVersion);
            initialFrame.Bytes.WriteIntL(ResponsePartitionCountFieldOffset, partitionCount);
            initialFrame.Bytes.WriteGuidL(ResponseClusterIdFieldOffset, clusterId);
            initialFrame.Bytes.WriteBoolL(ResponseFailoverSupportedFieldOffset, failoverSupported);
            clientMessage.Append(initialFrame);
            CodecUtil.EncodeNullable(clientMessage, address, AddressCodec.Encode);
            StringCodec.Encode(clientMessage, serverHazelcastVersion);
            return(clientMessage);
        }
        public static ClientMessage EncodeRequest(Hazelcast.CP.CPGroupId groupId, string name, IData @value)
        {
            var clientMessage = new ClientMessage
            {
                IsRetryable   = true,
                OperationName = "AtomicRef.Contains"
            };
            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);
            RaftGroupIdCodec.Encode(clientMessage, groupId);
            StringCodec.Encode(clientMessage, name);
            CodecUtil.EncodeNullable(clientMessage, @value, DataCodec.Encode);
            return(clientMessage);
        }
        public static ClientMessage EncodeEntryEvent(IData key, IData @value, IData oldValue, IData mergingValue, int eventType, Guid uuid, int numberOfAffectedEntries)
        {
            var clientMessage = new ClientMessage();
            var initialFrame  = new Frame(new byte[EventEntryInitialFrameSize], (FrameFlags)ClientMessageFlags.Unfragmented);

            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.MessageType, EventEntryMessageType);
            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.PartitionId, -1);
            initialFrame.Bytes.WriteIntL(EventEntryEventTypeFieldOffset, eventType);
            initialFrame.Bytes.WriteGuidL(EventEntryUuidFieldOffset, uuid);
            initialFrame.Bytes.WriteIntL(EventEntryNumberOfAffectedEntriesFieldOffset, numberOfAffectedEntries);
            clientMessage.Append(initialFrame);
            clientMessage.Flags |= ClientMessageFlags.Event;
            CodecUtil.EncodeNullable(clientMessage, key, DataCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, @value, DataCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, oldValue, DataCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, mergingValue, DataCodec.Encode);
            return(clientMessage);
        }
Exemplo n.º 5
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());
        }
        public static void Encode(ClientMessage clientMessage, Hazelcast.Client.Protocol.PagingPredicateHolder pagingPredicateHolder)
        {
            clientMessage.Add(BeginFrame.Copy());

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

            EncodeInt(initialFrame.Content, PageSizeFieldOffset, pagingPredicateHolder.PageSize);
            EncodeInt(initialFrame.Content, PageFieldOffset, pagingPredicateHolder.Page);
            EncodeByte(initialFrame.Content, IterationTypeIdFieldOffset, pagingPredicateHolder.IterationTypeId);
            clientMessage.Add(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.Add(EndFrame.Copy());
        }
        public static ClientMessage EncodeRequest(string name, long startSequence, int minCount, int maxCount, IData filter)
        {
            var clientMessage = CreateForEncode();

            clientMessage.IsRetryable   = true;
            clientMessage.OperationName = "Ringbuffer.ReadMany";
            var initialFrame = new Frame(new byte[RequestInitialFrameSize], UnfragmentedMessage);

            EncodeInt(initialFrame.Content, TypeFieldOffset, RequestMessageType);
            EncodeInt(initialFrame.Content, PartitionIdFieldOffset, -1);
            EncodeLong(initialFrame.Content, RequestStartSequenceFieldOffset, startSequence);
            EncodeInt(initialFrame.Content, RequestMinCountFieldOffset, minCount);
            EncodeInt(initialFrame.Content, RequestMaxCountFieldOffset, maxCount);
            clientMessage.Add(initialFrame);
            StringCodec.Encode(clientMessage, name);
            CodecUtil.EncodeNullable(clientMessage, filter, DataCodec.Encode);
            return(clientMessage);
        }
        public static ClientMessage EncodeRequest(string name, long startSequence, int minCount, int maxCount, IData filter)
        {
            var clientMessage = new ClientMessage
            {
                IsRetryable   = true,
                OperationName = "Ringbuffer.ReadMany"
            };
            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);
            initialFrame.Bytes.WriteLongL(RequestStartSequenceFieldOffset, startSequence);
            initialFrame.Bytes.WriteIntL(RequestMinCountFieldOffset, minCount);
            initialFrame.Bytes.WriteIntL(RequestMaxCountFieldOffset, maxCount);
            clientMessage.Append(initialFrame);
            StringCodec.Encode(clientMessage, name);
            CodecUtil.EncodeNullable(clientMessage, filter, DataCodec.Encode);
            return(clientMessage);
        }
Exemplo n.º 9
0
        public static ClientMessage EncodeRequest(string name, long startSequence, int minSize, int maxSize, IData predicate, IData projection)
        {
            var clientMessage = CreateForEncode();

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

            EncodeInt(initialFrame.Content, TypeFieldOffset, RequestMessageType);
            EncodeInt(initialFrame.Content, PartitionIdFieldOffset, -1);
            EncodeLong(initialFrame.Content, RequestStartSequenceFieldOffset, startSequence);
            EncodeInt(initialFrame.Content, RequestMinSizeFieldOffset, minSize);
            EncodeInt(initialFrame.Content, RequestMaxSizeFieldOffset, maxSize);
            clientMessage.Add(initialFrame);
            StringCodec.Encode(clientMessage, name);
            CodecUtil.EncodeNullable(clientMessage, predicate, DataCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, projection, DataCodec.Encode);
            return(clientMessage);
        }
        public static ClientMessage EncodeRequest(string name, long startSequence, int minSize, int maxSize, IData predicate, IData projection)
        {
            var clientMessage = new ClientMessage
            {
                IsRetryable   = true,
                OperationName = "Map.EventJournalRead"
            };
            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);
            initialFrame.Bytes.WriteLongL(RequestStartSequenceFieldOffset, startSequence);
            initialFrame.Bytes.WriteIntL(RequestMinSizeFieldOffset, minSize);
            initialFrame.Bytes.WriteIntL(RequestMaxSizeFieldOffset, maxSize);
            clientMessage.Append(initialFrame);
            StringCodec.Encode(clientMessage, name);
            CodecUtil.EncodeNullable(clientMessage, predicate, DataCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, projection, DataCodec.Encode);
            return(clientMessage);
        }
Exemplo n.º 11
0
        public static ClientMessage EncodeRequest(string clusterName, string username, string password, Guid uuid, string clientType, byte serializationVersion, string clientHazelcastVersion, string clientName, ICollection <string> labels)
        {
            var clientMessage = CreateForEncode();

            clientMessage.IsRetryable   = true;
            clientMessage.OperationName = "Client.Authentication";
            var initialFrame = new Frame(new byte[RequestInitialFrameSize], UnfragmentedMessage);

            EncodeInt(initialFrame.Content, TypeFieldOffset, RequestMessageType);
            EncodeInt(initialFrame.Content, PartitionIdFieldOffset, -1);
            EncodeGuid(initialFrame.Content, RequestUuidFieldOffset, uuid);
            EncodeByte(initialFrame.Content, RequestSerializationVersionFieldOffset, serializationVersion);
            clientMessage.Add(initialFrame);
            StringCodec.Encode(clientMessage, clusterName);
            CodecUtil.EncodeNullable(clientMessage, username, StringCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, password, StringCodec.Encode);
            StringCodec.Encode(clientMessage, clientType);
            StringCodec.Encode(clientMessage, clientHazelcastVersion);
            StringCodec.Encode(clientMessage, clientName);
            ListMultiFrameCodec.Encode(clientMessage, labels, StringCodec.Encode);
            return(clientMessage);
        }
        public static ClientMessage EncodeRequest(string clusterName, string username, string password, Guid uuid, string clientType, byte serializationVersion, string clientHazelcastVersion, string clientName, ICollection <string> labels)
        {
            var clientMessage = new ClientMessage
            {
                IsRetryable   = true,
                OperationName = "Client.Authentication"
            };
            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);
            initialFrame.Bytes.WriteGuidL(RequestUuidFieldOffset, uuid);
            initialFrame.Bytes.WriteByteL(RequestSerializationVersionFieldOffset, serializationVersion);
            clientMessage.Append(initialFrame);
            StringCodec.Encode(clientMessage, clusterName);
            CodecUtil.EncodeNullable(clientMessage, username, StringCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, password, StringCodec.Encode);
            StringCodec.Encode(clientMessage, clientType);
            StringCodec.Encode(clientMessage, clientHazelcastVersion);
            StringCodec.Encode(clientMessage, clientName);
            ListMultiFrameCodec.Encode(clientMessage, labels, StringCodec.Encode);
            return(clientMessage);
        }