From 6bf94a26bf66e6d5e0f29988e2ca47b4134bf645 Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Tue, 16 Jul 2024 11:46:27 +0200 Subject: [PATCH] Move OciMultiArchImageMetadata out of nested --- .../internal/registry/OciImageMetadataRegistry.kt | 12 ++++++------ .../oci/internal/registry/OciRepositoryHandler.kt | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/registry/OciImageMetadataRegistry.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/registry/OciImageMetadataRegistry.kt index ebf3991d..5d97fe61 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/registry/OciImageMetadataRegistry.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/registry/OciImageMetadataRegistry.kt @@ -13,12 +13,6 @@ import java.util.* */ internal class OciImageMetadataRegistry(val registryApi: OciRegistryApi) { - class OciMultiArchImageMetadata( - val platformToMetadata: Map, - val digest: OciDigest, - val size: Int, - ) - fun pullMultiArchImageMetadata( registry: String, imageReference: OciImageReference, @@ -363,3 +357,9 @@ internal class OciImageMetadataRegistry(val registryApi: OciRegistryApi) { } } } + +internal class OciMultiArchImageMetadata( + val platformToMetadata: Map, + val digest: OciDigest, + val size: Int, +) diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/registry/OciRepositoryHandler.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/registry/OciRepositoryHandler.kt index e437ad15..695ddd67 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/registry/OciRepositoryHandler.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/internal/registry/OciRepositoryHandler.kt @@ -52,7 +52,7 @@ internal class OciRepositoryHandler( private val credentials: Credentials?, ) : BiFunction> { - private val imageMetadataCache: AsyncCache = + private val imageMetadataCache: AsyncCache = Caffeine.newBuilder().maximumSize(100).expireAfterAccess(1, TimeUnit.MINUTES).buildAsync() private data class ImageMetadataCacheKey( @@ -284,7 +284,7 @@ internal class OciRepositoryHandler( registryUri: URI, imageReference: OciImageReference, credentials: Credentials?, - ): Mono { + ): Mono { return imageMetadataCache.getMono( ImageMetadataCacheKey(registryUri.toString(), imageReference, null, -1, credentials?.hashed()) ) { key -> @@ -303,7 +303,7 @@ internal class OciRepositoryHandler( digest: OciDigest, size: Int, credentials: Credentials?, - ): Mono { + ): Mono { return imageMetadataCache.getMono( ImageMetadataCacheKey(registryUri.toString(), imageReference, digest, size, credentials?.hashed()) ) { (registry, imageReference) ->