예제 #1
0
        internal static ClientMessage EncodeRequest(string name, long delta, bool getBeforeUpdate, IList <KeyValuePair <string, long> > replicaTimestamps, Address targetReplica)
        {
            var requiredDataSize = CalculateRequestDataSize(name, delta, getBeforeUpdate, replicaTimestamps, targetReplica);
            var clientMessage    = ClientMessage.CreateForEncode(requiredDataSize);

            clientMessage.SetMessageType((int)PNCounterMessageType.PNCounterAdd);
            clientMessage.SetRetryable(false);
            clientMessage.Set(name);
            clientMessage.Set(delta);
            clientMessage.Set(getBeforeUpdate);
            clientMessage.Set(replicaTimestamps.Count);

            foreach (var replicaTimestampsItem in replicaTimestamps)
            {
                var replicaTimestampsItemKey = replicaTimestampsItem.Key;
                var replicaTimestampsItemVal = replicaTimestampsItem.Value;

                clientMessage.Set(replicaTimestampsItemKey);
                clientMessage.Set(replicaTimestampsItemVal);
            }

            AddressCodec.Encode(targetReplica, clientMessage);
            clientMessage.UpdateFrameLength();

            return(clientMessage);
        }
        public static ClientMessage EncodeRequest(string name, string serviceName, Address target)
        {
            int           requiredDataSize = RequestParameters.CalculateDataSize(name, serviceName, target);
            ClientMessage clientMessage    = ClientMessage.CreateForEncode(requiredDataSize);

            clientMessage.SetMessageType((int)RequestType);
            clientMessage.SetRetryable(Retryable);
            clientMessage.Set(name);
            clientMessage.Set(serviceName);
            AddressCodec.Encode(target, clientMessage);
            clientMessage.UpdateFrameLength();
            return(clientMessage);
        }
        internal static ClientMessage EncodeRequest(string name, string serviceName, Address target)
        {
            var requiredDataSize = CalculateRequestDataSize(name, serviceName, target);
            var clientMessage    = ClientMessage.CreateForEncode(requiredDataSize);

            clientMessage.SetMessageType((int)ClientMessageType.ClientCreateProxy);
            clientMessage.SetRetryable(false);
            clientMessage.Set(name);
            clientMessage.Set(serviceName);
            AddressCodec.Encode(target, clientMessage);
            clientMessage.UpdateFrameLength();
            return(clientMessage);
        }
        internal static ClientMessage EncodeRequest(IList <string> names, Address address)
        {
            var requiredDataSize = CalculateRequestDataSize(names, address);
            var clientMessage    = ClientMessage.CreateForEncode(requiredDataSize);

            clientMessage.SetMessageType((int)MapMessageType.MapFetchNearCacheInvalidationMetadata);
            clientMessage.SetRetryable(false);
            clientMessage.Set(names.Count);
            foreach (var namesItem in names)
            {
                clientMessage.Set(namesItem);
            }
            AddressCodec.Encode(address, clientMessage);
            clientMessage.UpdateFrameLength();
            return(clientMessage);
        }