MCPcopy Create free account
hub / github.com/containerd/nerdctl / Transform

Method Transform

pkg/ocihook/state/state.go:75–93  ·  view source on GitHub ↗

Transform should be used to perform random mutations

(fun func(lf *Store) error)

Source from the content-addressed store, hash-verified

73
74// Transform should be used to perform random mutations
75func (lf *Store) Transform(fun func(lf *Store) error) (err error) {
76 defer func() {
77 if err != nil {
78 err = errors.Join(ErrLifecycleStore, err)
79 }
80 }()
81
82 return lf.safeStore.WithLock(func() error {
83 err = lf.rawLoad()
84 if err != nil {
85 return err
86 }
87 err = fun(lf)
88 if err != nil {
89 return err
90 }
91 return lf.rawSave()
92 })
93}
94
95// Delete will destroy the lifecycle data
96func (lf *Store) Delete() (err error) {

Callers 2

onCreateRuntimeFunction · 0.80
onPostStopFunction · 0.80

Calls 3

rawLoadMethod · 0.95
rawSaveMethod · 0.95
WithLockMethod · 0.65

Tested by

no test coverage detected