MCPcopy Index your code
hub / github.com/containerd/containerd / readDBVersion

Function readDBVersion

core/metadata/db_test.go:420–438  ·  view source on GitHub ↗
(db *bolt.DB, schema []byte)

Source from the content-addressed store, hash-verified

418}
419
420func readDBVersion(db *bolt.DB, schema []byte) (int, error) {
421 var version int
422 if err := db.View(func(tx *bolt.Tx) error {
423 bkt := tx.Bucket(schema)
424 if bkt == nil {
425 return fmt.Errorf("no version bucket: %w", errdefs.ErrNotFound)
426 }
427 vb := bkt.Get(bucketKeyDBVersion)
428 if vb == nil {
429 return fmt.Errorf("no version value: %w", errdefs.ErrNotFound)
430 }
431 v, _ := binary.Varint(vb)
432 version = int(v)
433 return nil
434 }); err != nil {
435 return 0, err
436 }
437 return version, nil
438}
439
440func TestMetadataCollector(t *testing.T) {
441 mdb, cs, sn, cleanup := newStores(t)

Callers 1

TestInitFunction · 0.85

Calls 2

ViewMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…