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

Method Acquire

pkg/netutil/networkstore/networkstore.go:68–83  ·  view source on GitHub ↗
(netConf NetworkConfig)

Source from the content-addressed store, hash-verified

66}
67
68func (ns *NetworkStore) Acquire(netConf NetworkConfig) (err error) {
69 defer func() {
70 if err != nil {
71 err = errors.Join(ErrNetworkStore, err)
72 }
73 }()
74
75 netConfJSON, err := json.Marshal(netConf)
76 if err != nil {
77 return fmt.Errorf("failed to marshal network config to JSON: %w", err)
78 }
79
80 return ns.safeStore.WithLock(func() error {
81 return ns.safeStore.Set(netConfJSON, networkConfigName)
82 })
83}
84
85func (ns *NetworkStore) Load() (err error) {
86 defer func() {

Callers

nothing calls this directly

Calls 3

MarshalMethod · 0.80
WithLockMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected