refactor(native): separate init from implementation
Part of #4513 Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
This commit is contained in:
		| @@ -22,6 +22,6 @@ import ( | ||||
| 	_ "github.com/containerd/containerd/runtime/v1/linux" | ||||
| 	_ "github.com/containerd/containerd/runtime/v2" | ||||
| 	_ "github.com/containerd/containerd/runtime/v2/runc/options" | ||||
| 	_ "github.com/containerd/containerd/snapshots/native" | ||||
| 	_ "github.com/containerd/containerd/snapshots/native/plugin" | ||||
| 	_ "github.com/containerd/containerd/snapshots/overlay/plugin" | ||||
| ) | ||||
|   | ||||
| @@ -19,5 +19,5 @@ | ||||
| package main | ||||
|  | ||||
| import ( | ||||
| 	_ "github.com/containerd/containerd/snapshots/native" | ||||
| 	_ "github.com/containerd/containerd/snapshots/native/plugin" | ||||
| ) | ||||
|   | ||||
| @@ -24,8 +24,6 @@ import ( | ||||
|  | ||||
| 	"github.com/containerd/containerd/log" | ||||
| 	"github.com/containerd/containerd/mount" | ||||
| 	"github.com/containerd/containerd/platforms" | ||||
| 	"github.com/containerd/containerd/plugin" | ||||
| 	"github.com/containerd/containerd/snapshots" | ||||
| 	"github.com/containerd/containerd/snapshots/storage" | ||||
|  | ||||
| @@ -33,17 +31,6 @@ import ( | ||||
| 	"github.com/pkg/errors" | ||||
| ) | ||||
|  | ||||
| func init() { | ||||
| 	plugin.Register(&plugin.Registration{ | ||||
| 		Type: plugin.SnapshotPlugin, | ||||
| 		ID:   "native", | ||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||
| 			ic.Meta.Platforms = append(ic.Meta.Platforms, platforms.DefaultSpec()) | ||||
| 			return NewSnapshotter(ic.Root) | ||||
| 		}, | ||||
| 	}) | ||||
| } | ||||
|  | ||||
| type snapshotter struct { | ||||
| 	root string | ||||
| 	ms   *storage.MetaStore | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jian Zeng
					Jian Zeng