Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option struct {
Value string `json:"value,omitempty"`
}
Option represents a bind option with its associated value if any.
type Path ¶
type Path struct { Source string `json:"source"` Destination string `json:"destination"` Options map[string]*Option `json:"options"` }
Path stores a parsed bind path specification. Source and Destination paths are required.
func ParseBindPath ¶
ParseBindPath parses a string specifying one or more (comma separated) bind paths in src[:dst[:options]] format, and returns all encountered bind paths as a slice. Options may be simple flags, e.g. 'rw', or take a value, e.g. 'id=2'. Multiple options are separated with commas. Note that multiple binds are also separated with commas, so the logic must distinguish.
func ParseDataBindPath ¶ added in v4.2.0
ParseDataBindPath parses a single data container bind spec in <src_sif>:<dest> format into an image bind specification, with image-src=/
func ParseMountString ¶
ParseMountString converts a --mount string into one or more BindPath structs.
Our intention is to support common docker --mount strings, but have additional fields for singularity specific concepts (image-src, id when binding out of an image file).
We use a CSV reader to parse the fields in a mount string according to CSV escaping rules. This is the approach docker uses to allow special characters in source / dest etc., and we wish to be as compatible as possible. It also allows us to handle multiple newline separated mounts, which is convenient for specifying multiple mounts in a single env var.
The fields are in key[=value] format. Flag options have no value, e.g.:
type=bind,source=/opt,destination=/other,rw
We only support type=bind at present, so assume this if type is missing and error for other types.
func (*Path) ID ¶
ID returns the value of the option id for a BindPath, or an empty string if the option wasn't set.