public static int CalculateDataSize(string name, string serviceName, Address target)
            {
                int dataSize = ClientMessage.HeaderSize;

                dataSize += ParameterUtil.CalculateDataSize(name);
                dataSize += ParameterUtil.CalculateDataSize(serviceName);
                dataSize += AddressCodec.CalculateDataSize(target);
                return(dataSize);
            }
        private static int CalculateRequestDataSize(IList <string> names, Address address)
        {
            var dataSize = ClientMessage.HeaderSize;

            dataSize += Bits.IntSizeInBytes;
            foreach (var namesItem in names)
            {
                dataSize += ParameterUtil.CalculateDataSize(namesItem);
            }
            dataSize += AddressCodec.CalculateDataSize(address);
            return(dataSize);
        }
Exemplo n.º 3
0
        private static int CalculateRequestDataSize(string name, IList <KeyValuePair <string, long> > replicaTimestamps, Address targetReplica)
        {
            var dataSize = ClientMessage.HeaderSize;

            dataSize += ParameterUtil.CalculateDataSize(name);
            dataSize += Bits.IntSizeInBytes;
            foreach (var replicaTimestampsItem in replicaTimestamps)
            {
                var replicaTimestampsItemKey = replicaTimestampsItem.Key;
                var replicaTimestampsItemVal = replicaTimestampsItem.Value;
                dataSize += ParameterUtil.CalculateDataSize(replicaTimestampsItemKey);
                dataSize += ParameterUtil.CalculateDataSize(replicaTimestampsItemVal);
            }
            dataSize += AddressCodec.CalculateDataSize(targetReplica);
            return(dataSize);
        }