utils

package
v0.0.0-...-282e76a Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

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

func GetHostIP() string

func IsDNS1123Label

func IsDNS1123Label(value string) bool

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

func IsDNSLabel

func IsDNSLabel(value string) bool

func JSONMarshal

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

func MatchesContentType

func MatchesContentType(contentType, expectedType string) bool

func Mount

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

func ParseImageRepoTag

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

func ParseTimeString

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

func PermInt

func PermInt(str string) int

func RandStr

func RandStr(strSize int, randType string) string

func RsplitN

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

func SetDaemon

func SetDaemon(d interface{})

func StringToSignal

func StringToSignal(s string) syscall.Signal

func Timeout

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

func UidInt

func UidInt(str string) int

func UriReader

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

Types

type FutureSet

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

func NewFutureSet

func NewFutureSet() *FutureSet

func (*FutureSet) Add

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

func (*FutureSet) IsFinished

func (fs *FutureSet) IsFinished() bool

func (*FutureSet) Wait

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

type Initializer

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

func NewInitializer

func NewInitializer(fn func()) *Initializer

func (*Initializer) Do

func (i *Initializer) Do()

type WaitGroupWithFail

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

func (*WaitGroupWithFail) Fail

func (wg *WaitGroupWithFail) Fail(err error)

func (*WaitGroupWithFail) Wait

func (wg *WaitGroupWithFail) Wait() error

Jump to

Keyboard shortcuts

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