MCPcopy
hub / github.com/containerd/containerd / NewSnapshotter

Function NewSnapshotter

plugins/snapshots/native/native.go:40–57  ·  view source on GitHub ↗

NewSnapshotter returns a Snapshotter which copies layers on the underlying file system. A metadata file is stored under the root.

(root string)

Source from the content-addressed store, hash-verified

38// NewSnapshotter returns a Snapshotter which copies layers on the underlying
39// file system. A metadata file is stored under the root.
40func NewSnapshotter(root string) (snapshots.Snapshotter, error) {
41 if err := os.MkdirAll(root, 0700); err != nil {
42 return nil, err
43 }
44 ms, err := storage.NewMetaStore(filepath.Join(root, "metadata.db"))
45 if err != nil {
46 return nil, err
47 }
48
49 if err := os.Mkdir(filepath.Join(root, "snapshots"), 0700); err != nil && !os.IsExist(err) {
50 return nil, err
51 }
52
53 return &snapshotter{
54 root: root,
55 ms: ms,
56 }, nil
57}
58
59// Stat returns the info for an active or committed snapshot by name or
60// key.

Callers 7

testDBFunction · 0.92
BenchmarkNativeFunction · 0.92
testDBFunction · 0.92
newStoresFunction · 0.92
newTestSnapshotterFunction · 0.92
initFunction · 0.92
newSnapshotterFunction · 0.70

Calls 2

NewMetaStoreFunction · 0.92
MkdirAllMethod · 0.65

Tested by 6

testDBFunction · 0.74
BenchmarkNativeFunction · 0.74
testDBFunction · 0.74
newStoresFunction · 0.74
newTestSnapshotterFunction · 0.74
newSnapshotterFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…