refactor(btrfs): separate init from implementation
Part of #4513 Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
This commit is contained in:
parent
4154235735
commit
a52daa26ae
@ -18,4 +18,4 @@
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import _ "github.com/containerd/containerd/snapshots/btrfs"
|
import _ "github.com/containerd/containerd/snapshots/btrfs/plugin"
|
||||||
|
@ -26,31 +26,18 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containerd/btrfs"
|
"github.com/containerd/btrfs"
|
||||||
|
"github.com/containerd/continuity/fs"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/containerd/log"
|
||||||
"github.com/containerd/containerd/mount"
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/containerd/containerd/platforms"
|
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
"github.com/containerd/containerd/snapshots"
|
"github.com/containerd/containerd/snapshots"
|
||||||
"github.com/containerd/containerd/snapshots/storage"
|
"github.com/containerd/containerd/snapshots/storage"
|
||||||
"github.com/containerd/continuity/fs"
|
|
||||||
|
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
plugin.Register(&plugin.Registration{
|
|
||||||
ID: "btrfs",
|
|
||||||
Type: plugin.SnapshotPlugin,
|
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
|
||||||
ic.Meta.Platforms = []ocispec.Platform{platforms.DefaultSpec()}
|
|
||||||
ic.Meta.Exports = map[string]string{"root": ic.Root}
|
|
||||||
return NewSnapshotter(ic.Root)
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
type snapshotter struct {
|
type snapshotter struct {
|
||||||
device string // device of the root
|
device string // device of the root
|
||||||
root string // root provides paths for internal storage.
|
root string // root provides paths for internal storage.
|
||||||
|
Loading…
Reference in New Issue
Block a user