func NewWeightdeviceOpt(validator ValidatorWeightFctType) WeightdeviceOpt {
	values := []*blkiodev.WeightDevice{}
	return WeightdeviceOpt{
		values:    values,
		validator: validator,
	}
}
NewWeightdeviceOpt creates a new WeightdeviceOpt
package opts
import (
	"fmt"
	"strconv"
	"strings"
	"github.com/docker/docker/api/types/blkiodev"
)
type ValidatorWeightFctType func(val string) (*blkiodev.WeightDevice, error)
func ValidateWeightDevice(val string) (*blkiodev.WeightDevice, error) {
	split := strings.SplitN(val, ":", 2)
	if len(split) != 2 {
		return nil, fmt.Errorf("bad format: %s", val)
	}
	if !strings.HasPrefix(split[0], "/dev/") {
		return nil, fmt.Errorf("bad format for device path: %s", val)
	}
	weight, err := strconv.ParseUint(split[1], 10, 0)
	if err != nil {
		return nil, fmt.Errorf("invalid weight for device: %s", val)
	}
	if weight > 0 && (weight < 10 || weight > 1000) {
		return nil, fmt.Errorf("invalid weight for device: %s", val)
	}
	return &blkiodev.WeightDevice{
		Path:   split[0],
		Weight: uint16(weight),
	}, nil
}
type WeightdeviceOpt struct {
	values    []*blkiodev.WeightDevice
	validator ValidatorWeightFctType
}