utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: Apache-2.0 Imports: 16 Imported by: 26

Documentation

Index

Constants

View Source
const (
	APIVERSION = "1.17"
)
View Source
const (
	Dns1123LabelFmt = "[a-z0-9]([-a-z0-9]*[a-z0-9])?"
)
View Source
const DockerRestrictedNameChars = `[a-zA-Z0-9][a-zA-Z0-9_.-]`

Variables

View Source
var (
	ErrTimeout = fmt.Errorf("timeout")
	BrokenChan = fmt.Errorf("Unexpected broken chan")
)
View Source
var (
	GITCOMMIT string = "0"
	VERSION   string

	IAMSTATIC string = "true"
	INITSHA1  string = ""
	INITPATH  string = ""

	HYPER_ROOT   string
	HYPER_FILE   string
	HYPER_DAEMON interface{}
)
View Source
var DockerRestrictedNamePattern = regexp.MustCompile(`^/?` + DockerRestrictedNameChars + `+$`)

RestrictedNamePattern is a regular expression to validate names against the collection of restricted characters.

View Source
var (
	MS_BIND uintptr = syscall.MS_BIND
)
View Source
var RestrictedVolumeNamePattern = regexp.MustCompile(`^` + DockerRestrictedNameChars + `+$`)

RestrictedVolumeNamePattern is a regular expression to validate volume names against the collection of restricted characters.

Functions

func FormatMountLabel

func FormatMountLabel(src, mountLabel string) string

FormatMountLabel returns a string to be used by the mount command. The format of this string will be used to alter the labeling of the mountpoint. The string returned is suitable to be used as the options field of the mount command. If you need to have additional mount point options, you can pass them in as the first parameter. Second parameter is the label that you wish to apply to all content in the mount point.

func GetHostIP added in v0.5.0

func GetHostIP() string

func IsDNS1123Label added in v0.8.0

func IsDNS1123Label(value string) bool

IsDNS1123Label tests for a string that conforms to the definition of a label in DNS (RFC 1123).

func IsDNSLabel added in v0.8.0

func IsDNSLabel(value string) bool

func JSONMarshal added in v0.5.0

func JSONMarshal(v interface{}, safeEncoding bool) ([]byte, error)

func MatchesContentType

func MatchesContentType(contentType, expectedType string) bool

func Mount added in v0.5.0

func Mount(source string, target string, fstype string, flags uintptr, data string) error

func ParseImageRepoTag added in v0.8.0

func ParseImageRepoTag(image string) (repo, name, tag string)

func ParseTimeString added in v0.6.2

func ParseTimeString(str string) (time.Time, error)

func PermInt added in v0.5.0

func PermInt(str string) int

func RandStr added in v0.5.0

func RandStr(strSize int, randType string) string

func RsplitN added in v0.7.0

func RsplitN(s, sep string, n int) []string

func SetDaemon added in v0.5.0

func SetDaemon(d interface{})

func StringToSignal added in v0.8.0

func StringToSignal(s string) syscall.Signal

func Timeout added in v0.8.0

func Timeout(second int) <-chan time.Time

func UidInt added in v0.5.0

func UidInt(str string) int

func UriReader added in v0.5.0

func UriReader(uri string) (io.ReadCloser, error)

Types

type FutureSet added in v0.8.0

type FutureSet struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewFutureSet added in v0.8.0

func NewFutureSet() *FutureSet

func (*FutureSet) Add added in v0.8.0

func (fs *FutureSet) Add(id string, op func() error)

func (*FutureSet) IsFinished added in v0.8.0

func (fs *FutureSet) IsFinished() bool

func (*FutureSet) Wait added in v0.8.0

func (fs *FutureSet) Wait(timeout time.Duration) error

type Initializer added in v0.8.0

type Initializer struct {
	// contains filtered or unexported fields
}

func NewInitializer added in v0.8.0

func NewInitializer(fn func()) *Initializer

func (*Initializer) Do added in v0.8.0

func (i *Initializer) Do()

type WaitGroupWithFail added in v0.8.0

type WaitGroupWithFail struct {
	sync.WaitGroup
	sync.Mutex
	// contains filtered or unexported fields
}

func (*WaitGroupWithFail) Fail added in v0.8.0

func (wg *WaitGroupWithFail) Fail(err error)

func (*WaitGroupWithFail) Wait added in v0.8.0

func (wg *WaitGroupWithFail) Wait() error

Jump to

Keyboard shortcuts

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