MCPcopy
hub / github.com/containerd/containerd / NewDB

Function NewDB

core/metadata/db.go:120–141  ·  view source on GitHub ↗

NewDB creates a new metadata database using the provided bolt database, content store, and snapshotters.

(db Transactor, cs content.Store, ss map[string]snapshots.Snapshotter, opts ...DBOpt)

Source from the content-addressed store, hash-verified

118// NewDB creates a new metadata database using the provided
119// bolt database, content store, and snapshotters.
120func NewDB(db Transactor, cs content.Store, ss map[string]snapshots.Snapshotter, opts ...DBOpt) *DB {
121 m := &DB{
122 db: db,
123 ss: make(map[string]*snapshotter, len(ss)),
124 dirtySS: map[string]struct{}{},
125 dbopts: dbOptions{
126 shared: true,
127 },
128 }
129
130 for _, opt := range opts {
131 opt(&m.dbopts)
132 }
133
134 // Initialize data stores
135 m.cs = newContentStore(m, m.dbopts.shared, cs)
136 for name, sn := range ss {
137 m.ss[name] = newSnapshotter(m, name, sn)
138 }
139
140 return m
141}
142
143// Close closes the underlying bolt database.
144// Acquires wlock so no GC cycle is in progress when bolt is closed.

Callers 15

FuzzImageStoreFunction · 0.92
FuzzLeaseManagerFunction · 0.92
FuzzContainerStoreFunction · 0.92
testDBFunction · 0.92
newTestSnapshotterFunction · 0.92
initFunction · 0.92
newTestInitContextFunction · 0.92
TestLeasesFunction · 0.85
TestLeasesListFunction · 0.85
TestLeaseResourceFunction · 0.85
TestContainersListFunction · 0.85

Calls 2

newContentStoreFunction · 0.70
newSnapshotterFunction · 0.70

Tested by 15

FuzzImageStoreFunction · 0.74
FuzzLeaseManagerFunction · 0.74
FuzzContainerStoreFunction · 0.74
testDBFunction · 0.74
newTestSnapshotterFunction · 0.74
newTestInitContextFunction · 0.74
TestLeasesFunction · 0.68
TestLeasesListFunction · 0.68
TestLeaseResourceFunction · 0.68
TestContainersListFunction · 0.68
TestImagesListFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…