Repository: containerd/containerd
Pull request #9790 (2024-02-08 06:46:29)

Move transfer and unpack packages to core
Packages related to transfer and unpacking provide core interfaces which use other core interfaces and part of common functionality. I did not include `pkg/archive` since that package is commonly used outside of containerd and does not use other containerd core packages.



Patch:
diff --git a/client/pull.go b/client/pull.go
index d7d79c8cf..6908fee9c 100644
--- a/client/pull.go
+++ b/client/pull.go
@@ -28,8 +28,8 @@ import (
 	"github.com/containerd/containerd/v2/core/remotes"
 	"github.com/containerd/containerd/v2/core/remotes/docker"
 	"github.com/containerd/containerd/v2/core/remotes/docker/schema1" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
+	"github.com/containerd/containerd/v2/core/unpack"
 	"github.com/containerd/containerd/v2/pkg/tracing"
-	"github.com/containerd/containerd/v2/pkg/unpack"
 	"github.com/containerd/errdefs"
 	"github.com/containerd/platforms"
 )
diff --git a/client/transfer.go b/client/transfer.go
index af240487a..c95116325 100644
--- a/client/transfer.go
+++ b/client/transfer.go
@@ -23,9 +23,9 @@ import (
 
 	streamingapi "github.com/containerd/containerd/v2/api/services/streaming/v1"
 	transferapi "github.com/containerd/containerd/v2/api/services/transfer/v1"
-	"github.com/containerd/containerd/v2/pkg/streaming"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	"github.com/containerd/containerd/v2/pkg/transfer/proxy"
+	"github.com/containerd/containerd/v2/core/streaming"
+	"github.com/containerd/containerd/v2/core/transfer"
+	"github.com/containerd/containerd/v2/core/transfer/proxy"
 	"github.com/containerd/containerd/v2/protobuf"
 	"github.com/containerd/errdefs"
 	"github.com/containerd/typeurl/v2"
diff --git a/cmd/ctr/commands/images/export.go b/cmd/ctr/commands/images/export.go
index a5a35b381..2f8c84ba2 100644
--- a/cmd/ctr/commands/images/export.go
+++ b/cmd/ctr/commands/images/export.go
@@ -26,9 +26,9 @@ import (
 
 	"github.com/containerd/containerd/v2/cmd/ctr/commands"
 	"github.com/containerd/containerd/v2/core/images/archive"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	tarchive "github.com/containerd/containerd/v2/pkg/transfer/archive"
-	"github.com/containerd/containerd/v2/pkg/transfer/image"
+	"github.com/containerd/containerd/v2/core/transfer"
+	tarchive "github.com/containerd/containerd/v2/core/transfer/archive"
+	"github.com/containerd/containerd/v2/core/transfer/image"
 	"github.com/containerd/platforms"
 )
 
diff --git a/cmd/ctr/commands/images/import.go b/cmd/ctr/commands/images/import.go
index 32cd72b84..58b33c791 100644
--- a/cmd/ctr/commands/images/import.go
+++ b/cmd/ctr/commands/images/import.go
@@ -28,9 +28,9 @@ import (
 	containerd "github.com/containerd/containerd/v2/client"
 	"github.com/containerd/containerd/v2/cmd/ctr/commands"
 	"github.com/containerd/containerd/v2/core/images/archive"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	tarchive "github.com/containerd/containerd/v2/pkg/transfer/archive"
-	"github.com/containerd/containerd/v2/pkg/transfer/image"
+	"github.com/containerd/containerd/v2/core/transfer"
+	tarchive "github.com/containerd/containerd/v2/core/transfer/archive"
+	"github.com/containerd/containerd/v2/core/transfer/image"
 	"github.com/containerd/log"
 	"github.com/containerd/platforms"
 )
diff --git a/cmd/ctr/commands/images/pull.go b/cmd/ctr/commands/images/pull.go
index 83ff19604..703542704 100644
--- a/cmd/ctr/commands/images/pull.go
+++ b/cmd/ctr/commands/images/pull.go
@@ -28,10 +28,10 @@ import (
 	"github.com/containerd/containerd/v2/cmd/ctr/commands"
 	"github.com/containerd/containerd/v2/cmd/ctr/commands/content"
 	"github.com/containerd/containerd/v2/core/images"
+	"github.com/containerd/containerd/v2/core/transfer"
+	"github.com/containerd/containerd/v2/core/transfer/image"
+	"github.com/containerd/containerd/v2/core/transfer/registry"
 	"github.com/containerd/containerd/v2/pkg/progress"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	"github.com/containerd/containerd/v2/pkg/transfer/image"
-	"github.com/containerd/containerd/v2/pkg/transfer/registry"
 	"github.com/containerd/log"
 	"github.com/containerd/platforms"
 	"github.com/opencontainers/image-spec/identity"
diff --git a/cmd/ctr/commands/images/push.go b/cmd/ctr/commands/images/push.go
index 62d4aa2d8..4cea6a247 100644
--- a/cmd/ctr/commands/images/push.go
+++ b/cmd/ctr/commands/images/push.go
@@ -32,10 +32,10 @@ import (
 	"github.com/containerd/containerd/v2/core/images"
 	"github.com/containerd/containerd/v2/core/remotes"
 	"github.com/containerd/containerd/v2/core/remotes/docker"
+	"github.com/containerd/containerd/v2/core/transfer"
+	"github.com/containerd/containerd/v2/core/transfer/image"
+	"github.com/containerd/containerd/v2/core/transfer/registry"
 	"github.com/containerd/containerd/v2/pkg/progress"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	"github.com/containerd/containerd/v2/pkg/transfer/image"
-	"github.com/containerd/containerd/v2/pkg/transfer/registry"
 	"github.com/containerd/log"
 	"github.com/containerd/platforms"
 	digest "github.com/opencontainers/go-digest"
diff --git a/cmd/ctr/commands/images/tag.go b/cmd/ctr/commands/images/tag.go
index c01833988..b718d2163 100644
--- a/cmd/ctr/commands/images/tag.go
+++ b/cmd/ctr/commands/images/tag.go
@@ -22,7 +22,7 @@ import (
 	"github.com/urfave/cli"
 
 	"github.com/containerd/containerd/v2/cmd/ctr/commands"
-	"github.com/containerd/containerd/v2/pkg/transfer/image"
+	"github.com/containerd/containerd/v2/core/transfer/image"
 	"github.com/containerd/errdefs"
 	"github.com/distribution/reference"
 )
diff --git a/cmd/ctr/commands/resolver.go b/cmd/ctr/commands/resolver.go
index 1146513e6..d5d8636a4 100644
--- a/cmd/ctr/commands/resolver.go
+++ b/cmd/ctr/commands/resolver.go
@@ -34,7 +34,7 @@ import (
 	"github.com/containerd/containerd/v2/core/remotes"
 	"github.com/containerd/containerd/v2/core/remotes/docker"
 	"github.com/containerd/containerd/v2/core/remotes/docker/config"
-	"github.com/containerd/containerd/v2/pkg/transfer/registry"
+	"github.com/containerd/containerd/v2/core/transfer/registry"
 	"github.com/containerd/log"
 	"github.com/urfave/cli"
 )
diff --git a/contrib/v2-migrate.sh b/contrib/v2-migrate.sh
index b0bcf6faf..cb07521d0 100755
--- a/contrib/v2-migrate.sh
+++ b/contrib/v2-migrate.sh
@@ -53,9 +53,12 @@ for GOFILE in $(find . -name "*.go" | grep -v "./vendor/" ); do
   perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/kmutex/$1$2"github.com\/containerd\/containerd\/v2\/internal\/kmutex/g' $GOFILE
   perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/randutil/$1$2"github.com\/containerd\/containerd\/v2\/internal\/randutil/g' $GOFILE
   perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/registrar/$1$2"github.com\/containerd\/containerd\/v2\/internal\/registrar/g' $GOFILE
+  perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/streaming/$1$2"github.com\/containerd\/containerd\/v2\/core\/streaming/g' $GOFILE
   perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/testutil/$1$2"github.com\/containerd\/containerd\/v2\/internal\/testutil/g' $GOFILE
   perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/tomlext/$1$2"github.com\/containerd\/containerd\/v2\/internal\/tomlext/g' $GOFILE
+  perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/transfer/$1$2"github.com\/containerd\/containerd\/v2\/core\/transfer/g' $GOFILE
   perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/truncindex/$1$2"github.com\/containerd\/containerd\/v2\/internal\/truncindex/g' $GOFILE
+  perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/unpack/$1$2"github.com\/containerd\/containerd\/v2\/core\/unpack/g' $GOFILE
   perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/metrics/$1$2"github.com\/containerd\/containerd\/v2\/core\/metrics/g' $GOFILE
   perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/runtime/$1$2"github.com\/containerd\/containerd\/v2\/core\/runtime/g' $GOFILE
 
diff --git a/pkg/streaming/streaming.go b/core/streaming/streaming.go
similarity index 100%
rename from pkg/streaming/streaming.go
rename to core/streaming/streaming.go
diff --git a/pkg/transfer/archive/exporter.go b/core/transfer/archive/exporter.go
similarity index 96%
rename from pkg/transfer/archive/exporter.go
rename to core/transfer/archive/exporter.go
index d89fa0a5a..885270706 100644
--- a/pkg/transfer/archive/exporter.go
+++ b/core/transfer/archive/exporter.go
@@ -28,9 +28,9 @@ import (
 	"github.com/containerd/containerd/v2/core/content"
 	"github.com/containerd/containerd/v2/core/images"
 	"github.com/containerd/containerd/v2/core/images/archive"
-	"github.com/containerd/containerd/v2/pkg/streaming"
-	"github.com/containerd/containerd/v2/pkg/transfer/plugins"
-	tstreaming "github.com/containerd/containerd/v2/pkg/transfer/streaming"
+	"github.com/containerd/containerd/v2/core/streaming"
+	"github.com/containerd/containerd/v2/core/transfer/plugins"
+	tstreaming "github.com/containerd/containerd/v2/core/transfer/streaming"
 	"github.com/containerd/log"
 	"github.com/containerd/platforms"
 )
diff --git a/pkg/transfer/archive/importer.go b/core/transfer/archive/importer.go
similarity index 95%
rename from pkg/transfer/archive/importer.go
rename to core/transfer/archive/importer.go
index 00991801c..5b19cfb77 100644
--- a/pkg/transfer/archive/importer.go
+++ b/core/transfer/archive/importer.go
@@ -26,8 +26,8 @@ import (
 	transferapi "github.com/containerd/containerd/v2/api/types/transfer"
 	"github.com/containerd/containerd/v2/core/content"
 	"github.com/containerd/containerd/v2/core/images/archive"
-	"github.com/containerd/containerd/v2/pkg/streaming"
-	tstreaming "github.com/containerd/containerd/v2/pkg/transfer/streaming"
+	"github.com/containerd/containerd/v2/core/streaming"
+	tstreaming "github.com/containerd/containerd/v2/core/transfer/streaming"
 	"github.com/containerd/log"
 )
 
diff --git a/pkg/transfer/image/imagestore.go b/core/transfer/image/imagestore.go
similarity index 98%
rename from pkg/transfer/image/imagestore.go
rename to core/transfer/image/imagestore.go
index 9802966b3..97298d44c 100644
--- a/pkg/transfer/image/imagestore.go
+++ b/core/transfer/image/imagestore.go
@@ -29,9 +29,9 @@ import (
 	"github.com/containerd/containerd/v2/core/images"
 	"github.com/containerd/containerd/v2/core/images/archive"
 	"github.com/containerd/containerd/v2/core/remotes"
-	"github.com/containerd/containerd/v2/pkg/streaming"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	"github.com/containerd/containerd/v2/pkg/transfer/plugins"
+	"github.com/containerd/containerd/v2/core/streaming"
+	"github.com/containerd/containerd/v2/core/transfer"
+	"github.com/containerd/containerd/v2/core/transfer/plugins"
 	"github.com/containerd/errdefs"
 	"github.com/containerd/platforms"
 )
diff --git a/pkg/transfer/image/imagestore_test.go b/core/transfer/image/imagestore_test.go
similarity index 100%
rename from pkg/transfer/image/imagestore_test.go
rename to core/transfer/image/imagestore_test.go
diff --git a/pkg/transfer/local/export.go b/core/transfer/local/export.go
similarity index 96%
rename from pkg/transfer/local/export.go
rename to core/transfer/local/export.go
index df63241f9..cf09be578 100644
--- a/pkg/transfer/local/export.go
+++ b/core/transfer/local/export.go
@@ -20,7 +20,7 @@ import (
 	"context"
 
 	"github.com/containerd/containerd/v2/core/images"
-	"github.com/containerd/containerd/v2/pkg/transfer"
+	"github.com/containerd/containerd/v2/core/transfer"
 )
 
 func (ts *localTransferService) exportStream(ctx context.Context, ig transfer.ImageGetter, is transfer.ImageExporter, tops *transfer.Config) error {
diff --git a/pkg/transfer/local/import.go b/core/transfer/local/import.go
similarity index 97%
rename from pkg/transfer/local/import.go
rename to core/transfer/local/import.go
index 2ff5a21d5..467ae82d5 100644
--- a/pkg/transfer/local/import.go
+++ b/core/transfer/local/import.go
@@ -25,8 +25,8 @@ import (
 
 	"github.com/containerd/containerd/v2/core/content"
 	"github.com/containerd/containerd/v2/core/images"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	"github.com/containerd/containerd/v2/pkg/unpack"
+	"github.com/containerd/containerd/v2/core/transfer"
+	"github.com/containerd/containerd/v2/core/unpack"
 	"github.com/containerd/errdefs"
 	"github.com/containerd/log"
 )
diff --git a/pkg/transfer/local/progress.go b/core/transfer/local/progress.go
similarity index 99%
rename from pkg/transfer/local/progress.go
rename to core/transfer/local/progress.go
index d156c6abe..042c362c7 100644
--- a/pkg/transfer/local/progress.go
+++ b/core/transfer/local/progress.go
@@ -24,7 +24,7 @@ import (
 
 	"github.com/containerd/containerd/v2/core/content"
 	"github.com/containerd/containerd/v2/core/remotes"
-	"github.com/containerd/containerd/v2/pkg/transfer"
+	"github.com/containerd/containerd/v2/core/transfer"
 	"github.com/containerd/log"
 	"github.com/opencontainers/go-digest"
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
diff --git a/pkg/transfer/local/pull.go b/core/transfer/local/pull.go
similarity index 98%
rename from pkg/transfer/local/pull.go
rename to core/transfer/local/pull.go
index 16287e4e8..691ae813d 100644
--- a/pkg/transfer/local/pull.go
+++ b/core/transfer/local/pull.go
@@ -24,9 +24,9 @@ import (
 	"github.com/containerd/containerd/v2/core/images"
 	"github.com/containerd/containerd/v2/core/remotes"
 	"github.com/containerd/containerd/v2/core/remotes/docker"
+	"github.com/containerd/containerd/v2/core/transfer"
+	"github.com/containerd/containerd/v2/core/unpack"
 	"github.com/containerd/containerd/v2/defaults"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	"github.com/containerd/containerd/v2/pkg/unpack"
 	"github.com/containerd/errdefs"
 	"github.com/containerd/log"
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
diff --git a/pkg/transfer/local/push.go b/core/transfer/local/push.go
similarity index 99%
rename from pkg/transfer/local/push.go
rename to core/transfer/local/push.go
index 52aa6b1bc..0af2f7f45 100644
--- a/pkg/transfer/local/push.go
+++ b/core/transfer/local/push.go
@@ -25,7 +25,7 @@ import (
 	"github.com/containerd/containerd/v2/core/content"
 	"github.com/containerd/containerd/v2/core/images"
 	"github.com/containerd/containerd/v2/core/remotes"
-	"github.com/containerd/containerd/v2/pkg/transfer"
+	"github.com/containerd/containerd/v2/core/transfer"
 	"github.com/containerd/errdefs"
 	"github.com/containerd/platforms"
 	"github.com/opencontainers/go-digest"
diff --git a/pkg/transfer/local/tag.go b/core/transfer/local/tag.go
similarity index 94%
rename from pkg/transfer/local/tag.go
rename to core/transfer/local/tag.go
index d69894c5e..07ccf6848 100644
--- a/pkg/transfer/local/tag.go
+++ b/core/transfer/local/tag.go
@@ -19,7 +19,7 @@ package local
 import (
 	"context"
 
-	"github.com/containerd/containerd/v2/pkg/transfer"
+	"github.com/containerd/containerd/v2/core/transfer"
 )
 
 func (ts *localTransferService) tag(ctx context.Context, ig transfer.ImageGetter, is transfer.ImageStorer, tops *transfer.Config) error {
diff --git a/pkg/transfer/local/transfer.go b/core/transfer/local/transfer.go
similarity index 98%
rename from pkg/transfer/local/transfer.go
rename to core/transfer/local/transfer.go
index 99c4b3c07..03dfa026e 100644
--- a/pkg/transfer/local/transfer.go
+++ b/core/transfer/local/transfer.go
@@ -28,10 +28,10 @@ import (
 	"github.com/containerd/containerd/v2/core/content"
 	"github.com/containerd/containerd/v2/core/images"
 	"github.com/containerd/containerd/v2/core/leases"
+	"github.com/containerd/containerd/v2/core/transfer"
+	"github.com/containerd/containerd/v2/core/unpack"
 	"github.com/containerd/containerd/v2/internal/kmutex"
 	"github.com/containerd/containerd/v2/pkg/imageverifier"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	"github.com/containerd/containerd/v2/pkg/unpack"
 	"github.com/containerd/errdefs"
 )
 
diff --git a/pkg/transfer/plugins/plugins.go b/core/transfer/plugins/plugins.go
similarity index 100%
rename from pkg/transfer/plugins/plugins.go
rename to core/transfer/plugins/plugins.go
diff --git a/pkg/transfer/proxy/transfer.go b/core/transfer/proxy/transfer.go
similarity index 95%
rename from pkg/transfer/proxy/transfer.go
rename to core/transfer/proxy/transfer.go
index 77da20477..3fb7ca18b 100644
--- a/pkg/transfer/proxy/transfer.go
+++ b/core/transfer/proxy/transfer.go
@@ -25,10 +25,10 @@ import (
 
 	transferapi "github.com/containerd/containerd/v2/api/services/transfer/v1"
 	transfertypes "github.com/containerd/containerd/v2/api/types/transfer"
+	"github.com/containerd/containerd/v2/core/streaming"
+	"github.com/containerd/containerd/v2/core/transfer"
+	tstreaming "github.com/containerd/containerd/v2/core/transfer/streaming"
 	"github.com/containerd/containerd/v2/pkg/oci"
-	"github.com/containerd/containerd/v2/pkg/streaming"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	tstreaming "github.com/containerd/containerd/v2/pkg/transfer/streaming"
 	"github.com/containerd/log"
 	"github.com/containerd/typeurl/v2"
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
diff --git a/pkg/transfer/registry/registry.go b/core/transfer/registry/registry.go
similarity index 96%
rename from pkg/transfer/registry/registry.go
rename to core/transfer/registry/registry.go
index 26a245bf4..7fdca72ee 100644
--- a/pkg/transfer/registry/registry.go
+++ b/core/transfer/registry/registry.go
@@ -28,10 +28,10 @@ import (
 	transfertypes "github.com/containerd/containerd/v2/api/types/transfer"
 	"github.com/containerd/containerd/v2/core/remotes"
 	"github.com/containerd/containerd/v2/core/remotes/docker"
-	"github.com/containerd/containerd/v2/pkg/streaming"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	"github.com/containerd/containerd/v2/pkg/transfer/plugins"
-	tstreaming "github.com/containerd/containerd/v2/pkg/transfer/streaming"
+	"github.com/containerd/containerd/v2/core/streaming"
+	"github.com/containerd/containerd/v2/core/transfer"
+	"github.com/containerd/containerd/v2/core/transfer/plugins"
+	tstreaming "github.com/containerd/containerd/v2/core/transfer/streaming"
 	"github.com/containerd/log"
 	"github.com/containerd/typeurl/v2"
 	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
diff --git a/pkg/transfer/streaming/stream.go b/core/transfer/streaming/stream.go
similarity index 98%
rename from pkg/transfer/streaming/stream.go
rename to core/transfer/streaming/stream.go
index 4036c084c..9fe66790e 100644
--- a/pkg/transfer/streaming/stream.go
+++ b/core/transfer/streaming/stream.go
@@ -27,7 +27,7 @@ import (
 	"time"
 
 	transferapi "github.com/containerd/containerd/v2/api/types/transfer"
-	"github.com/containerd/containerd/v2/pkg/streaming"
+	"github.com/containerd/containerd/v2/core/streaming"
 	"github.com/containerd/log"
 	"github.com/containerd/typeurl/v2"
 )
diff --git a/pkg/transfer/streaming/writer.go b/core/transfer/streaming/writer.go
similarity index 98%
rename from pkg/transfer/streaming/writer.go
rename to core/transfer/streaming/writer.go
index 8da3cb177..d192b8b84 100644
--- a/pkg/transfer/streaming/writer.go
+++ b/core/transfer/streaming/writer.go
@@ -23,7 +23,7 @@ import (
 	"sync/atomic"
 
 	transferapi "github.com/containerd/containerd/v2/api/types/transfer"
-	"github.com/containerd/containerd/v2/pkg/streaming"
+	"github.com/containerd/containerd/v2/core/streaming"
 	"github.com/containerd/log"
 	"github.com/containerd/typeurl/v2"
 )
diff --git a/plugins/services/streaming/service.go b/plugins/services/streaming/service.go
index e65f63106..6b048011d 100644
--- a/plugins/services/streaming/service.go
+++ b/plugins/services/streaming/service.go
@@ -21,7 +21,7 @@ import (
 	"io"
 
 	api "github.com/containerd/containerd/v2/api/services/streaming/v1"
-	"github.com/containerd/containerd/v2/pkg/streaming"
+	"github.com/containerd/containerd/v2/core/streaming"
 	"github.com/containerd/containerd/v2/plugins"
 	"github.com/containerd/containerd/v2/protobuf"
 	ptypes "github.com/containerd/containerd/v2/protobuf/types"
diff --git a/plugins/services/transfer/service.go b/plugins/services/transfer/service.go
index 8d921dbaa..d56cc7cba 100644
--- a/plugins/services/transfer/service.go
+++ b/plugins/services/transfer/service.go
@@ -22,10 +22,10 @@ import (
 	transferapi "github.com/containerd/containerd/v2/api/services/transfer/v1"
 	"github.com/containerd/containerd/v2/api/types"
 	transferTypes "github.com/containerd/containerd/v2/api/types/transfer"
+	"github.com/containerd/containerd/v2/core/streaming"
+	"github.com/containerd/containerd/v2/core/transfer"
+	tplugins "github.com/containerd/containerd/v2/core/transfer/plugins"
 	"github.com/containerd/containerd/v2/pkg/oci"
-	"github.com/containerd/containerd/v2/pkg/streaming"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	tplugins "github.com/containerd/containerd/v2/pkg/transfer/plugins"
 	"github.com/containerd/containerd/v2/plugins"
 	ptypes "github.com/containerd/containerd/v2/protobuf/types"
 	"github.com/containerd/errdefs"
diff --git a/plugins/streaming/manager.go b/plugins/streaming/manager.go
index 8a3cddffb..af45bbd1c 100644
--- a/plugins/streaming/manager.go
+++ b/plugins/streaming/manager.go
@@ -23,9 +23,9 @@ import (
 
 	"github.com/containerd/containerd/v2/core/leases"
 	"github.com/containerd/containerd/v2/core/metadata"
+	"github.com/containerd/containerd/v2/core/streaming"
 	"github.com/containerd/containerd/v2/pkg/gc"
 	"github.com/containerd/containerd/v2/pkg/namespaces"
-	"github.com/containerd/containerd/v2/pkg/streaming"
 	"github.com/containerd/containerd/v2/plugins"
 	"github.com/containerd/errdefs"
 	"github.com/containerd/plugin"
diff --git a/plugins/transfer/plugin.go b/plugins/transfer/plugin.go
index 49842b12a..f0b6c5138 100644
--- a/plugins/transfer/plugin.go
+++ b/plugins/transfer/plugin.go
@@ -22,9 +22,9 @@ import (
 	"github.com/containerd/containerd/v2/core/diff"
 	"github.com/containerd/containerd/v2/core/leases"
 	"github.com/containerd/containerd/v2/core/metadata"
+	"github.com/containerd/containerd/v2/core/transfer/local"
+	"github.com/containerd/containerd/v2/core/unpack"
 	"github.com/containerd/containerd/v2/pkg/imageverifier"
-	"github.com/containerd/containerd/v2/pkg/transfer/local"
-	"github.com/containerd/containerd/v2/pkg/unpack"
 	"github.com/containerd/containerd/v2/plugins"
 	"github.com/containerd/errdefs"
 	"github.com/containerd/log"
@@ -33,9 +33,9 @@ import (
 	"github.com/containerd/plugin/registry"
 
 	// Load packages with type registrations
-	_ "github.com/containerd/containerd/v2/pkg/transfer/archive"
-	_ "github.com/containerd/containerd/v2/pkg/transfer/image"
-	_ "github.com/containerd/containerd/v2/pkg/transfer/registry"
+	_ "github.com/containerd/containerd/v2/core/transfer/archive"
+	_ "github.com/containerd/containerd/v2/core/transfer/image"
+	_ "github.com/containerd/containerd/v2/core/transfer/registry"
 )
 
 // Register local transfer service plugin


Test patch:
diff --git a/pkg/transfer/local/pull_test.go b/core/transfer/local/pull_test.go
similarity index 97%
rename from pkg/transfer/local/pull_test.go
rename to core/transfer/local/pull_test.go
index c46cf07e9..155829543 100644
--- a/pkg/transfer/local/pull_test.go
+++ b/core/transfer/local/pull_test.go
@@ -19,9 +19,9 @@ package local
 import (
 	"testing"
 
+	"github.com/containerd/containerd/v2/core/transfer"
+	"github.com/containerd/containerd/v2/core/unpack"
 	"github.com/containerd/containerd/v2/defaults"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	"github.com/containerd/containerd/v2/pkg/unpack"
 	"github.com/containerd/platforms"
 )
 
diff --git a/pkg/transfer/streaming/stream_test.go b/core/transfer/streaming/stream_test.go
similarity index 98%
rename from pkg/transfer/streaming/stream_test.go
rename to core/transfer/streaming/stream_test.go
index f54a31b9e..2ca6015ba 100644
--- a/pkg/transfer/streaming/stream_test.go
+++ b/core/transfer/streaming/stream_test.go
@@ -22,7 +22,7 @@ import (
 	"io"
 	"testing"
 
-	"github.com/containerd/containerd/v2/pkg/streaming"
+	"github.com/containerd/containerd/v2/core/streaming"
 	"github.com/containerd/typeurl/v2"
 )
 
diff --git a/pkg/transfer/transfer.go b/core/transfer/transfer.go
similarity index 100%
rename from pkg/transfer/transfer.go
rename to core/transfer/transfer.go
diff --git a/pkg/unpack/unpacker.go b/core/unpack/unpacker.go
similarity index 100%
rename from pkg/unpack/unpacker.go
rename to core/unpack/unpacker.go
diff --git a/integration/client/import_test.go b/integration/client/import_test.go
index ced7ea1f6..a874b3274 100644
--- a/integration/client/import_test.go
+++ b/integration/client/import_test.go
@@ -37,13 +37,13 @@ import (
 	"github.com/containerd/containerd/v2/core/images"
 	"github.com/containerd/containerd/v2/core/images/archive"
 	"github.com/containerd/containerd/v2/core/leases"
+	"github.com/containerd/containerd/v2/core/transfer"
+	tarchive "github.com/containerd/containerd/v2/core/transfer/archive"
+	"github.com/containerd/containerd/v2/core/transfer/image"
 	"github.com/containerd/containerd/v2/pkg/archive/compression"
 	"github.com/containerd/containerd/v2/pkg/archive/tartest"
 	"github.com/containerd/containerd/v2/pkg/namespaces"
 	"github.com/containerd/containerd/v2/pkg/oci"
-	"github.com/containerd/containerd/v2/pkg/transfer"
-	tarchive "github.com/containerd/containerd/v2/pkg/transfer/archive"
-	"github.com/containerd/containerd/v2/pkg/transfer/image"
 	"github.com/containerd/platforms"
 	"github.com/google/uuid"
 
diff --git a/integration/client/transfer_test.go b/integration/client/transfer_test.go
index 8d8a58363..2745a03b2 100644
--- a/integration/client/transfer_test.go
+++ b/integration/client/transfer_test.go
@@ -24,7 +24,7 @@ import (
 	"testing"
 
 	containerd "github.com/containerd/containerd/v2/client"
-	"github.com/containerd/containerd/v2/pkg/transfer/archive"
+	"github.com/containerd/containerd/v2/core/transfer/archive"
 )
 
 func TestTransferEcho(t *testing.T) {