spec

package
v9.4.46+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProxyWriteRegex = regexp.MustCompile(api.SpecProxyWrite + "=([A-Za-z]+),?")

	Sharedv4FailoverStrategyRegex = regexp.MustCompile(api.SpecSharedv4FailoverStrategy + "=([A-Za-z]+),?")
	AutoFstrimRegex               = regexp.MustCompile(api.SpecAutoFstrim + "=([A-Za-z]+),?")
	SpecIoThrottleRdIOPSRegex     = regexp.MustCompile(api.SpecIoThrottleRdIOPS + "=([0-9]+),?")
	SpecIoThrottleWrIOPSRegex     = regexp.MustCompile(api.SpecIoThrottleWrIOPS + "=([0-9]+),?")
	SpecIoThrottleRdBWRegex       = regexp.MustCompile(api.SpecIoThrottleRdBW + "=([0-9]+),?")
	SpecIoThrottleWrBWRegex       = regexp.MustCompile(api.SpecIoThrottleWrBW + "=([0-9]+),?")
)

Functions

This section is empty.

Types

type SpecHandler

type SpecHandler interface {
	// SpecOptsFromString parses options from the name and returns in a map.
	// The input string should have known keys in the following format:
	// "scale=value;size=value;name=volname"
	// If the spec was parsed, it returns:
	//   (true, options_map, parsed_name)
	// If the input string didn't contain the name, it returns:
	//   (false, nil, inputString)
	SpecOptsFromString(inputString string) (
		bool,
		map[string]string,
		string,
	)

	// SpecFromString parses options from the name.
	// If the scheduler was unable to pass in the volume spec via the API,
	// the spec can be passed in via the name in the format:
	// "key=value;key=value;name=volname"
	// source is populated if key parent=<volume_id> is specified.
	// If the spec was parsed, it returns:
	//  	(true, parsed_spec, locator, source, parsed_name)
	// If the input string didn't contain the string, it returns:
	// 	(false, DefaultSpec(), nil, nil, inputString)
	SpecFromString(inputString string) (
		bool,
		*api.VolumeSpec,
		*api.VolumeLocator,
		*api.Source,
		string,
	)

	// GetTokenFromString parses the token from the name.
	// If the token is not present in the name, it will
	// check inside of the docker options passed in.
	// If the token was parsed, it returns:
	// 	(token, true)
	// If the token wasn't parsed, it returns:
	// 	("", false)
	GetTokenFromString(str string) (string, bool)

	// GetTokenSecretContextFromString parses the full token secret request from the name.
	// If the token secret was parsed, it returns:
	// 	(tokenSecretContext, true)
	// If the token secret wasn't parsed, it returns:
	// 	(nil, false)
	GetTokenSecretContextFromString(str string) (*api.TokenSecretContext, bool)

	// SpecFromOpts parses in docker options passed in the the docker run
	// command of the form --opt name=value
	// source is populated if --opt parent=<volume_id> is specified.
	// If the options are validated then it returns:
	// 	(resultant_VolumeSpec, source, locator, nil)
	// If the options have invalid values then it returns:
	//	(nil, nil, nil, error)
	SpecFromOpts(opts map[string]string) (
		*api.VolumeSpec,
		*api.VolumeLocator,
		*api.Source,
		error,
	)

	// UpdateSpecFromOpts parses in volume options passed through the opts map and updates given spec, locator & source
	// If the options are validated then it returns:
	// 	(resultant_VolumeSpec, source, locator, nil)
	// If the options have invalid values then it returns:
	//	(nil, nil, nil, error)
	UpdateSpecFromOpts(opts map[string]string, spec *api.VolumeSpec, locator *api.VolumeLocator, source *api.Source) (
		*api.VolumeSpec,
		*api.VolumeLocator,
		*api.Source,
		error,
	)

	// Returns a default VolumeSpec if no docker options or string encoding
	// was provided.
	DefaultSpec() *api.VolumeSpec
}

SpecHandler provides conversion function from what gets passed in over the plugin API to an api.VolumeSpec object.

func NewSpecHandler

func NewSpecHandler() SpecHandler

NewSpecHandler returns a new SpecHandler interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL