Skip to content

Commit

Permalink
Rely on contaienrd's GC for cleanup of temporary content
Browse files Browse the repository at this point in the history
Signed-off-by: Kohei Tokunaga <[email protected]>
  • Loading branch information
ktock committed Dec 3, 2024
1 parent 60a7bf8 commit e8aa426
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions nativeconverter/zstdchunked/zstdchunked.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"fmt"
"io"
"sync"

"github.com/containerd/containerd/v2/core/content"
"github.com/containerd/containerd/v2/core/images"
Expand All @@ -38,15 +37,6 @@ import (
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)

type unMap struct {
mu sync.Mutex
}

var (
mu sync.Mutex
uncompressMap = map[digest.Digest]*unMap{}
)

type zstdCompression struct {
*zstdchunked.Decompressor
*zstdchunked.Compressor
Expand Down Expand Up @@ -111,14 +101,6 @@ func LayerConvertFuncWithCompressionLevel(compressionLevel zstd.EncoderLevel, op
uncompressedDesc := &desc
// We need to uncompress the archive first
if !uncompress.IsUncompressedType(desc.MediaType) {
mu.Lock()
if _, ok := uncompressMap[desc.Digest]; !ok {
uncompressMap[desc.Digest] = &unMap{}
}
uncompressMap[desc.Digest].mu.Lock()
mu.Unlock()
defer uncompressMap[desc.Digest].mu.Unlock()

var err error
uncompressedDesc, err = uncompress.LayerConvertFunc(ctx, cs, desc)
if err != nil {
Expand All @@ -127,11 +109,6 @@ func LayerConvertFuncWithCompressionLevel(compressionLevel zstd.EncoderLevel, op
if uncompressedDesc == nil {
return nil, fmt.Errorf("unexpectedly got the same blob after compression (%s, %q)", desc.Digest, desc.MediaType)
}
defer func() {
if err := cs.Delete(ctx, uncompressedDesc.Digest); err != nil {
log.G(ctx).WithError(err).WithField("uncompressedDesc", uncompressedDesc).Warn("failed to remove tmp uncompressed layer")
}
}()
log.G(ctx).Debugf("zstdchunked: uncompressed %s into %s", desc.Digest, uncompressedDesc.Digest)
}

Expand Down

0 comments on commit e8aa426

Please sign in to comment.