Skip to content

Commit

Permalink
Move OciMultiArchImageMetadata out of nested
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtSilvio committed Jul 16, 2024
1 parent 5fec199 commit 6bf94a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ import java.util.*
*/
internal class OciImageMetadataRegistry(val registryApi: OciRegistryApi) {

class OciMultiArchImageMetadata(
val platformToMetadata: Map<Platform, OciMetadata>,
val digest: OciDigest,
val size: Int,
)

fun pullMultiArchImageMetadata(
registry: String,
imageReference: OciImageReference,
Expand Down Expand Up @@ -363,3 +357,9 @@ internal class OciImageMetadataRegistry(val registryApi: OciRegistryApi) {
}
}
}

internal class OciMultiArchImageMetadata(
val platformToMetadata: Map<Platform, OciMetadata>,
val digest: OciDigest,
val size: Int,
)
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal class OciRepositoryHandler(
private val credentials: Credentials?,
) : BiFunction<HttpServerRequest, HttpServerResponse, Publisher<Void>> {

private val imageMetadataCache: AsyncCache<ImageMetadataCacheKey, OciImageMetadataRegistry.OciMultiArchImageMetadata> =
private val imageMetadataCache: AsyncCache<ImageMetadataCacheKey, OciMultiArchImageMetadata> =
Caffeine.newBuilder().maximumSize(100).expireAfterAccess(1, TimeUnit.MINUTES).buildAsync()

private data class ImageMetadataCacheKey(
Expand Down Expand Up @@ -284,7 +284,7 @@ internal class OciRepositoryHandler(
registryUri: URI,
imageReference: OciImageReference,
credentials: Credentials?,
): Mono<OciImageMetadataRegistry.OciMultiArchImageMetadata> {
): Mono<OciMultiArchImageMetadata> {
return imageMetadataCache.getMono(
ImageMetadataCacheKey(registryUri.toString(), imageReference, null, -1, credentials?.hashed())
) { key ->
Expand All @@ -303,7 +303,7 @@ internal class OciRepositoryHandler(
digest: OciDigest,
size: Int,
credentials: Credentials?,
): Mono<OciImageMetadataRegistry.OciMultiArchImageMetadata> {
): Mono<OciMultiArchImageMetadata> {
return imageMetadataCache.getMono(
ImageMetadataCacheKey(registryUri.toString(), imageReference, digest, size, credentials?.hashed())
) { (registry, imageReference) ->
Expand Down

0 comments on commit 6bf94a2

Please sign in to comment.