Allow control over which storage cache to use
This allows one to better control the usage of the cache and turn it off completely. The storage configuration module was modified to allow parameters to be passed to just the storage implementation, rather than to the driver. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
44b14ceadc
commit
919d972e65
4 changed files with 52 additions and 8 deletions
|
@ -187,7 +187,12 @@ type Storage map[string]Parameters
|
|||
func (storage Storage) Type() string {
|
||||
// Return only key in this map
|
||||
for k := range storage {
|
||||
return k
|
||||
switch k {
|
||||
case "cache":
|
||||
// allow configuration of caching
|
||||
default:
|
||||
return k
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
@ -211,9 +216,17 @@ func (storage *Storage) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||
if len(storageMap) > 1 {
|
||||
types := make([]string, 0, len(storageMap))
|
||||
for k := range storageMap {
|
||||
types = append(types, k)
|
||||
switch k {
|
||||
case "cache":
|
||||
// allow configuration of caching
|
||||
default:
|
||||
types = append(types, k)
|
||||
}
|
||||
}
|
||||
|
||||
if len(types) > 1 {
|
||||
return fmt.Errorf("Must provide exactly one storage type. Provided: %v", types)
|
||||
}
|
||||
return fmt.Errorf("Must provide exactly one storage type. Provided: %v", types)
|
||||
}
|
||||
*storage = storageMap
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue