private async Task <IResultSegment <FunctionIndexEntry> > Read1Async(string hostName) { var snapshots = await GetSnapshotsAsync(hostName); var results = Array.ConvertAll(snapshots, x => FunctionIndexEntry.Create( FunctionIndexEntry.CreateOtherMetadata(x), x.HostVersion)); return(new ResultSegment <FunctionIndexEntry>(results, null)); }
public IResultSegment <FunctionIndexEntry> Read(int maximumResults, string continuationToken) { BlobContinuationToken blobContinuationToken = BlobContinuationTokenSerializer.Deserialize(continuationToken); BlobResultSegment blobSegment; try { blobSegment = _functionsContainer.ListBlobsSegmented( prefix: _functionsPrefix, 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 <FunctionIndexEntry> results = new List <FunctionIndexEntry>(); // Cast from IListBlobItem to ICloudBlob is safe due to useFlatBlobListing: true above. foreach (ICloudBlob blob in blobSegment.Results) { IDictionary <string, string> metadata = blob.Metadata; DateTimeOffset version = _versionMapper.GetVersion(metadata); FunctionIndexEntry result = FunctionIndexEntry.Create(metadata, version); results.Add(result); } string nextContinuationToken = BlobContinuationTokenSerializer.Serialize(blobSegment.ContinuationToken); return(new ResultSegment <FunctionIndexEntry>(results, nextContinuationToken)); }