MCPcopy
hub / github.com/containerd/containerd / NewManager

Function NewManager

core/mount/manager/manager.go:81–109  ·  view source on GitHub ↗
(db *bolt.DB, targetDir string, opts ...Opt)

Source from the content-addressed store, hash-verified

79}
80
81func NewManager(db *bolt.DB, targetDir string, opts ...Opt) (mount.Manager, error) {
82 options := managerOptions{}
83 for _, o := range opts {
84 if err := o(&options); err != nil {
85 return nil, err
86 }
87 }
88 if err := os.MkdirAll(targetDir, 0700); err != nil {
89 return nil, err
90 }
91 tr, err := os.OpenRoot(targetDir)
92 if err != nil {
93 return nil, fmt.Errorf("failed to open target root %q: %w", targetDir, err)
94 }
95 rootMap := map[string]*os.Root{
96 tr.Name(): tr,
97 }
98 for _, r := range options.roots {
99 rootMap[r.Name()] = r
100 }
101
102 return &mountManager{
103 db: db,
104 targets: tr,
105 handlers: options.handlers,
106 rootMap: rootMap,
107 activate: kmutex.New(),
108 }, nil
109}
110
111type mountManager struct {
112 db *bolt.DB

Callers 14

withMountManagerFunction · 0.92
initFunction · 0.92
TestLoopbackMountFunction · 0.70
TestLoopbackOverlayFunction · 0.70
TestManagerFunction · 0.70
TestGCFunction · 0.70
TestInfoFunction · 0.70
TestInfoSystemMountsFunction · 0.70

Calls 3

NewFunction · 0.92
MkdirAllMethod · 0.65
NameMethod · 0.65

Tested by 12

TestLoopbackMountFunction · 0.56
TestLoopbackOverlayFunction · 0.56
TestManagerFunction · 0.56
TestGCFunction · 0.56
TestInfoFunction · 0.56
TestInfoSystemMountsFunction · 0.56
TestCloseFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…