Skip to content

Commit ebdd5fe

Browse files
committed
cli/compose/types: ServiceVolumeConfig: use strong type for Consistency field
Using a strong type for this field, to make it clearer what's supported, and to allow assigning values without having to cast them. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent b754114 commit ebdd5fe

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎cli/compose/convert/volume.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func createMountFromVolume(volume composetypes.ServiceVolumeConfig) mount.Mount
3030
Target: volume.Target,
3131
ReadOnly: volume.ReadOnly,
3232
Source: volume.Source,
33-
Consistency: mount.Consistency(volume.Consistency),
33+
Consistency: volume.Consistency,
3434
}
3535
}
3636

‎internal/volumespec/types.go‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import "github.com/moby/moby/api/types/mount"
44

55
// VolumeConfig are references to a volume used by a service
66
type VolumeConfig struct {
7-
Type mount.Type `yaml:",omitempty" json:"type,omitempty"`
8-
Source string `yaml:",omitempty" json:"source,omitempty"`
9-
Target string `yaml:",omitempty" json:"target,omitempty"`
10-
ReadOnly bool `mapstructure:"read_only" yaml:"read_only,omitempty" json:"read_only,omitempty"`
11-
Consistency string `yaml:",omitempty" json:"consistency,omitempty"`
12-
Bind *BindOpts `yaml:",omitempty" json:"bind,omitempty"`
13-
Volume *VolumeOpts `yaml:",omitempty" json:"volume,omitempty"`
14-
Image *ImageOpts `yaml:",omitempty" json:"image,omitempty"`
15-
Tmpfs *TmpFsOpts `yaml:",omitempty" json:"tmpfs,omitempty"`
16-
Cluster *ClusterOpts `yaml:",omitempty" json:"cluster,omitempty"`
7+
Type mount.Type `yaml:",omitempty" json:"type,omitempty"`
8+
Source string `yaml:",omitempty" json:"source,omitempty"`
9+
Target string `yaml:",omitempty" json:"target,omitempty"`
10+
ReadOnly bool `mapstructure:"read_only" yaml:"read_only,omitempty" json:"read_only,omitempty"`
11+
Consistency mount.Consistency `yaml:",omitempty" json:"consistency,omitempty"`
12+
Bind *BindOpts `yaml:",omitempty" json:"bind,omitempty"`
13+
Volume *VolumeOpts `yaml:",omitempty" json:"volume,omitempty"`
14+
Image *ImageOpts `yaml:",omitempty" json:"image,omitempty"`
15+
Tmpfs *TmpFsOpts `yaml:",omitempty" json:"tmpfs,omitempty"`
16+
Cluster *ClusterOpts `yaml:",omitempty" json:"cluster,omitempty"`
1717
}
1818

1919
// BindOpts are options for a service volume of type bind

0 commit comments

Comments
 (0)