MCPcopy
hub / github.com/docker/compose / servicesUsingVolume

Method servicesUsingVolume

pkg/compose/reconcile.go:342–354  ·  view source on GitHub ↗

servicesUsingVolume returns the names of services that mount the given compose volume key, sorted for deterministic plan output. nolint:unused // see reconciler.prompt field doc — seam consolidation.

(volumeKey string)

Source from the content-addressed store, hash-verified

340//
341//nolint:unused // see reconciler.prompt field doc — seam consolidation.
342func (r *reconciler) servicesUsingVolume(volumeKey string) []string {
343 var names []string
344 for _, key := range sortedKeys(r.project.Services) {
345 svc := r.project.Services[key]
346 for _, v := range svc.Volumes {
347 if v.Source == volumeKey {
348 names = append(names, svc.Name)
349 break
350 }
351 }
352 }
353 return names
354}
355
356// containersForServices returns all observed containers belonging to the given
357// service names.

Callers 1

planRecreateVolumeMethod · 0.95

Calls 1

sortedKeysFunction · 0.85

Tested by

no test coverage detected