github.com/MaximeAubanel/moby@v1.13.1/volume/volume_copy.go (about)

     1  package volume
     2  
     3  import "strings"
     4  
     5  // {<copy mode>=isEnabled}
     6  var copyModes = map[string]bool{
     7  	"nocopy": false,
     8  }
     9  
    10  func copyModeExists(mode string) bool {
    11  	_, exists := copyModes[mode]
    12  	return exists
    13  }
    14  
    15  // GetCopyMode gets the copy mode from the mode string for mounts
    16  func getCopyMode(mode string) (bool, bool) {
    17  	for _, o := range strings.Split(mode, ",") {
    18  		if isEnabled, exists := copyModes[o]; exists {
    19  			return isEnabled, true
    20  		}
    21  	}
    22  	return DefaultCopyMode, false
    23  }