private async Task <OpenStreamResult> GetFileStreamAsync(Context context, ContentHash hash) { Debug.Assert(_contentStoreByCacheName != null); // Iterate through all known stores, looking for content in each. // In most of our configurations there is just one store anyway, // and doing this means both we can callers don't have // to deal with cache roots and drive letters. foreach (KeyValuePair <string, IContentStore> entry in _contentStoreByCacheName) { IStreamStore store = entry.Value as IStreamStore; if (store != null) { OpenStreamResult result = await store.StreamContentAsync(context, hash); if (result.Code != OpenStreamResult.ResultCode.ContentNotFound) { return(result); } } } return(new OpenStreamResult(OpenStreamResult.ResultCode.ContentNotFound, $"{hash} to found")); }