public IEnumerable <string> GetTags(string repository)
        {
            TagList result;

            try
            {
                result = dockerDistribution.GetTagListAsync(repository, AuthHandler.RepoPullScope(repository)).Result;
                return(result?.Tags ?? Array.Empty <string>());
            }
            catch (AggregateException ex)
            {
                if (ex.InnerException is ApiException apiEx && apiEx.StatusCode == System.Net.HttpStatusCode.NotFound)
                {
                    return(Array.Empty <string>());
                }
        public async Task <string> GetTagDigestAsync(string repository, string tag)
        {
            var result = await dockerDistribution.GetTagDigestAsync(repository, tag, AuthHandler.RepoPullScope(repository));

            return(result.Headers.First(h => h.Key.Equals("Docker-Content-Digest", StringComparison.OrdinalIgnoreCase)).Value.First());
        }
        public async Task <Data.ImageConfig> GetImageConfigAsync(string repository, string digest)
        {
            var path = localClient.BlobPath(digest);

            await LockedPathExecAsync(path, async() =>
            {
                var result = await dockerDistribution.GetStringBlobAsync(repository, digest, AuthHandler.RepoPullScope(repository));
                await WriteFileAsync(path, result);
            });

            return(await localClient.GetImageConfigAsync(repository, digest));
        }
        public async Task <Stream> GetLayerArchiveAsync(string repository, string layerDigest)
        {
            await FetchBlobAsync(repository, layerDigest, AuthHandler.RepoPullScope(repository));

            return(await localClient.GetLayerArchiveAsync(repository, layerDigest));
        }
        public async Task <Stream> GetFileAsync(string repository, Layer layer, string path)
        {
            await FetchBlobAsync(repository, layer.Digest, AuthHandler.RepoPullScope(repository));

            return(await localClient.GetFileAsync(repository, layer, path));
        }
        public async Task <ImageSet> GetImageSetAsync(string repository, string tag)
        {
            string digest = tag.IsDigest() ? tag : await GetTagDigestAsync(repository, tag);

            var path = localClient.BlobPath(digest);

            await LockedPathExecAsync(path, async() =>
            {
                var result = await dockerDistribution.GetManifestAsync(repository, digest, AuthHandler.RepoPullScope(repository));
                await WriteFileAsync(path, result);
            });

            return(await localClient.GetImageSetAsync(repository, digest));
        }
 public Task <ImageConfig> GetImageConfigAsync(string repository, string digest) => CacheLocalData?
 ExecAsync(AuthHandler.RepoPullScope(repository), ObjectDigestKey(digest), () => innerClient.GetImageConfigAsync(repository, digest)) :
     innerClient.GetImageConfigAsync(repository, digest);
 public Task <Layer> GetLayerAsync(string repository, string layerDigest) => CacheLocalData?
 ExecAsync(AuthHandler.RepoPullScope(repository), ObjectDigestKey(layerDigest), () => innerClient.GetLayerAsync(repository, layerDigest)) :
     innerClient.GetLayerAsync(repository, layerDigest);
        // these methods are normally cheap to run from disk, but in case of a high-latency filesystem (looking at you, Azure File) we can still cache them

        public Task <ImageSet> GetImageSetAsync(string repository, string tag) => CacheLocalData?
        ExecAsync(AuthHandler.RepoPullScope(repository), RepoImageSetKey(repository, tag), () => innerClient.GetImageSetAsync(repository, tag)) :
            innerClient.GetImageSetAsync(repository, tag);
Пример #10
0
 public IEnumerable <string> GetTags(string repository) =>
 ExecAsync(AuthHandler.RepoPullScope(repository), RepoTagsKey(repository), () => Task.FromResult(innerClient.GetTags(repository))).Result;
Пример #11
0
 public Task <string> GetTagDigestAsync(string repository, string tag) =>
 ExecAsync(AuthHandler.RepoPullScope(repository), RepoTagDigestKey(repository, tag), () => innerClient.GetTagDigestAsync(repository, tag));