refactor(native): separate init from implementation

Part of #4513

Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
This commit is contained in:
Jian Zeng 2020-09-03 19:58:31 +08:00
parent 98b0b2a7c6
commit c50ff694f0
No known key found for this signature in database
GPG Key ID: 1040B69865E7D86C
3 changed files with 2 additions and 15 deletions

View File

@ -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"
)

View File

@ -19,5 +19,5 @@
package main
import (
_ "github.com/containerd/containerd/snapshots/native"
_ "github.com/containerd/containerd/snapshots/native/plugin"
)

View File

@ -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