const string RowKeyFormat       = "{0}"; // functionName

        public static FunctionDefinitionEntity New(string functionName)
        {
            return(new FunctionDefinitionEntity
            {
                PartitionKey = PartitionKeyFormat,
                RowKey = string.Format(CultureInfo.InvariantCulture, RowKeyFormat, TableScheme.NormalizeFunctionName(functionName))
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Build a FunctionId from the host and function name.
        /// </summary>
        /// <param name="hostName"></param>
        /// <param name="functionName"></param>
        /// <returns></returns>
        public static FunctionId Build(string hostName, string functionName)
        {
            var value = string.Concat(
                TableScheme.NormalizeFunctionName(hostName),
                "-",
                TableScheme.NormalizeFunctionName(functionName));

            return(Parse(value));
        }
Ejemplo n.º 3
0
        // Salt must be deterministic.
        internal static string RowKeyTimeStampDescending(string functionName, DateTime startTime, Guid salt)
        {
            var x = (DateTime.MaxValue.Ticks - startTime.Ticks);

            // Need Salt since timestamp may not be unique
            int    salt2  = salt.GetHashCode();
            string rowKey = string.Format(CultureInfo.InvariantCulture, RowKeyFormat, TableScheme.NormalizeFunctionName(functionName), x, salt2);

            return(rowKey);
        }
Ejemplo n.º 4
0
        // No salt. This is a prefix, so we'll pick up all ranges.
        private static string RowKeyTimeStampDescendingPrefix(string functionName, DateTime startTime)
        {
            var x = (DateTime.MaxValue.Ticks - startTime.Ticks);

            string rowKey = string.Format(CultureInfo.InvariantCulture, RowKeyPrefix, TableScheme.NormalizeFunctionName(functionName), x);

            return(rowKey);
        }
        internal static string RowKeyTimeInterval(string functionId, DateTime dateTime, string hostId)
        {
            var    bucket = TimeBucket.ConvertToBucket(dateTime);
            string rowKey = string.Format(CultureInfo.InvariantCulture, RowKeyFormat, TableScheme.NormalizeFunctionName(functionId), bucket, hostId);

            return(rowKey);
        }
Ejemplo n.º 6
0
        private async Task <IFunctionDefinition[]> GetFunctionDefinitionsHelperAsync(CloudTable table, string hostName)
        {
            TableQuery <FunctionDefinitionEntity> query;

            if (hostName == null)
            {
                query = TableScheme.GetRowsInPartition <FunctionDefinitionEntity>(TableScheme.FuncDefIndexPK);
            }
            else
            {
                query = TableScheme.GetRowsWithPrefixAsync <FunctionDefinitionEntity>(TableScheme.FuncDefIndexPK,
                                                                                      TableScheme.NormalizeFunctionName(hostName));
            }
            var results = await table.SafeExecuteQueryAsync(query);

            return(results);
        }