MCPcopy
hub / github.com/containerd/containerd / update

Function update

core/metadata/bolt.go:47–55  ·  view source on GitHub ↗

update gets a writable bolt db transaction either from the context or starts a new one with the provided bolt database.

(ctx context.Context, db Transactor, fn func(*bolt.Tx) error)

Source from the content-addressed store, hash-verified

45// update gets a writable bolt db transaction either from the context
46// or starts a new one with the provided bolt database.
47func update(ctx context.Context, db Transactor, fn func(*bolt.Tx) error) error {
48 tx, ok := boltutil.Transaction(ctx)
49 if !ok {
50 return db.Update(fn)
51 } else if !tx.Writable() {
52 return fmt.Errorf("unable to use transaction from context: %w", errbolt.ErrTxNotWritable)
53 }
54 return fn(tx)
55}

Callers 15

CreateMethod · 0.85
DeleteMethod · 0.85
AddResourceMethod · 0.85
DeleteResourceMethod · 0.85
CreateMethod · 0.85
UpdateMethod · 0.85
DeleteMethod · 0.85
UpdateMethod · 0.85
DeleteMethod · 0.85
AbortMethod · 0.85
WriterMethod · 0.85
CommitMethod · 0.85

Calls 2

TransactionFunction · 0.92
UpdateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…