internal static TableQuery <RecentPerFuncEntity> GetRecentFunctionsQuery(
            RecentFunctionQuery queryParams
            )
        {
            var functionId = queryParams.FunctionId;
            var start      = queryParams.Start;
            var end        = queryParams.End;

            string rowKeyStart = RowKeyTimeStampDescendingPrefix(functionId, end);

            // add a tick to create a greater row key so that we lexically compare
            var    start2    = (start == DateTime.MinValue) ? start : start.AddTicks(-1);
            string rowKeyEnd = RowKeyTimeStampDescendingPrefix(functionId, start2);

            string partKey = PartitionKeyFormat;

            var rangeQuery = TableScheme.GetRowsInRange <RecentPerFuncEntity>(
                partKey, rowKeyStart, rowKeyEnd);

            if (queryParams.MaximumResults > 0)
            {
                rangeQuery = rangeQuery.Take(queryParams.MaximumResults);
            }
            return(rangeQuery);
        }
Example #2
0
        // Could be very long
        public async Task <Segment <IRecentFunctionEntry> > GetRecentFunctionInstancesAsync(
            RecentFunctionQuery queryParams,
            string continuationToken)
        {
            TableQuery <RecentPerFuncEntity> rangeQuery = RecentPerFuncEntity.GetRecentFunctionsQuery(queryParams);

            var iter = await EpochTableIterator.NewAsync(_tableLookup);

            var results = await iter.SafeExecuteQuerySegmentedAsync <RecentPerFuncEntity>(rangeQuery, queryParams.Start, queryParams.End);

            return(results.As <IRecentFunctionEntry>());
        }
Example #3
0
        // Could be very long
        public async Task <Segment <IRecentFunctionEntry> > GetRecentFunctionInstancesAsync(
            RecentFunctionQuery queryParams,
            string continuationToken)
        {
            TableQuery <RecentPerFuncEntity> rangeQuery = RecentPerFuncEntity.GetRecentFunctionsQuery(queryParams);

            CancellationToken      cancellationToken;
            TableContinuationToken realContinuationToken = Utility.DeserializeToken(continuationToken);;
            var segment = await _instanceTable.ExecuteQuerySegmentedAsync <RecentPerFuncEntity>(
                rangeQuery,
                realContinuationToken,
                cancellationToken);

            return(new Segment <IRecentFunctionEntry>(segment.Results.ToArray(), Utility.SerializeToken(segment.ContinuationToken)));
        }
        internal static TableQuery<RecentPerFuncEntity> GetRecentFunctionsQuery(
            RecentFunctionQuery queryParams
            )
        {
            string functionName = queryParams.FunctionName;
            var start = queryParams.Start;
            var end = queryParams.End;

            string rowKeyStart = RowKeyTimeStampDescendingPrefix(functionName, end);

            // add a tick to create a greater row key so that we lexically compare
            var start2 = (start == DateTime.MinValue) ? start : start.AddTicks(-1);
            string rowKeyEnd = RowKeyTimeStampDescendingPrefix(functionName, start2);

            string partKey = PartitionKeyFormat;

            var rangeQuery = TableScheme.GetRowsInRange<RecentPerFuncEntity>(
                partKey, rowKeyStart, rowKeyEnd);

            rangeQuery.Take(queryParams.MaximumResults);
            return rangeQuery;
        }
        private async Task<IResultSegment<RecentInvocationEntry>> Read3Async(
            string functionId, int maximumResults, string continuationToken)
        {
            var queryParams = new RecentFunctionQuery
            {
                FunctionName = functionId,
                MaximumResults = maximumResults,
                Start = DateTime.MinValue,
                End = DateTime.MaxValue
            };

            var segment = await _reader.GetRecentFunctionInstancesAsync(queryParams, continuationToken);

            var results = Array.ConvertAll(segment.Results, item =>
                RecentInvocationEntry.Create(RecentInvocationEntry.CreateMetadata(item.ConvertToSnapshot())));

            return new ResultSegment<RecentInvocationEntry>(results, segment.ContinuationToken);
        }
 public Task<Segment<IRecentFunctionEntry>> GetRecentFunctionInstancesAsync(RecentFunctionQuery query, string continuationToken)
 {
     throw new NotImplementedException();
 }
        // Could be very long 
        public async Task<Segment<IRecentFunctionEntry>> GetRecentFunctionInstancesAsync(
            RecentFunctionQuery queryParams,
            string continuationToken)
        {
            TableQuery<RecentPerFuncEntity> rangeQuery = RecentPerFuncEntity.GetRecentFunctionsQuery(queryParams);

            CancellationToken cancellationToken;
            TableContinuationToken realContinuationToken = Utility.DeserializeToken(continuationToken); ;
            var segment = await _instanceTable.ExecuteQuerySegmentedAsync<RecentPerFuncEntity>(
                rangeQuery, 
                realContinuationToken, 
                cancellationToken);

            return new Segment<IRecentFunctionEntry>(segment.Results.ToArray(), Utility.SerializeToken(segment.ContinuationToken));
        }