Beispiel #1
0
        private static RecentInvocationEntry Convert(IRecentFunctionEntry entity)
        {
            var snapshot = entity.ConvertToSnapshot();
            var metadata = RecentInvocationEntry.CreateMetadata(snapshot);

            return(RecentInvocationEntry.Create(metadata));
        }
        public IResultSegment <RecentInvocationEntry> Read(string relativePrefix, int maximumResults, string continuationToken)
        {
            BlobContinuationToken blobContinuationToken = BlobContinuationTokenSerializer.Deserialize(continuationToken);

            BlobResultSegment blobSegment;
            string            prefix = _directoryPrefix + relativePrefix;

            try
            {
                blobSegment = _container.ListBlobsSegmented(
                    prefix: prefix,
                    useFlatBlobListing: true,
                    blobListingDetails: BlobListingDetails.Metadata,
                    maxResults: maximumResults,
                    currentToken: blobContinuationToken,
                    options: null,
                    operationContext: null);
            }
            catch (StorageException exception)
            {
                if (exception.IsNotFound())
                {
                    return(null);
                }
                else
                {
                    throw;
                }
            }

            if (blobSegment == null)
            {
                return(null);
            }

            List <RecentInvocationEntry> results = new List <RecentInvocationEntry>();

            // Cast from IListBlobItem to ICloudBlob is safe due to useFlatBlobListing: true above.
            foreach (ICloudBlob blob in blobSegment.Results)
            {
                RecentInvocationEntry result = RecentInvocationEntry.Create(blob.Metadata);
                results.Add(result);
            }

            string nextContinuationToken = BlobContinuationTokenSerializer.Serialize(blobSegment.ContinuationToken);

            return(new ResultSegment <RecentInvocationEntry>(results, nextContinuationToken));
        }
Beispiel #3
0
        private async Task <IResultSegment <RecentInvocationEntry> > Read3Async(
            FunctionId functionId, int maximumResults, string continuationToken)
        {
            var queryParams = new RecentFunctionQuery
            {
                FunctionId     = 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));
        }