util

package
v0.2.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2015 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogDirPathSuffix = "/var/log/rexray"
	EtcDirPathSuffix = "/etc/rexray"
	BinDirPathSuffix = "/usr/bin"
	RunDirPathSuffix = "/var/run/rexray"
	LibDirPathSuffix = "/var/lib/rexray"
	UnitFilePath     = "/etc/systemd/system/rexray.service"
	InitFilePath     = "/etc/init.d/rexray"
	EnvFileName      = "rexray.env"

	TrimPattern          = `(?s)^\s*(.*?)\s*$`
	NetworkAdressPattern = `(?i)^((?:(?:tcp|udp|ip)[46]?)|(?:unix(?:gram|packet)?))://(.+)$`

	LetterBytes     = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	LetterIndexBits = 6
	LetterIndexMask = 1<<LetterIndexBits - 1
	LetterIndexMax  = 63 / LetterIndexBits
)

Variables

This section is empty.

Functions

func BinDirPath

func BinDirPath() string

func BinFilePath

func BinFilePath() string

func EtcDirPath

func EtcDirPath() string

func EtcFilePath

func EtcFilePath(fileName string) string

func FileExists

func FileExists(filePath string) bool

func FileExistsInPath

func FileExistsInPath(fileName string) bool

func GetLocalIP

func GetLocalIP() string

GetLocalIP returns the non loopback local IP of the host

func GetPathParts

func GetPathParts(path string) (dirPath, fileName, absPath string)

func GetPrefix

func GetPrefix() string

func GetThisPathParts

func GetThisPathParts() (dirPath, fileName, absPath string)

func HomeDir

func HomeDir() string

func Install

func Install(args ...string)

func InstallChownRoot

func InstallChownRoot(args ...string)

func InstallDirChownRoot

func InstallDirChownRoot(dirPath string)

func IsDirEmpty

func IsDirEmpty(name string) (bool, error)

func IsPrefixed

func IsPrefixed() bool

func LibDirPath

func LibDirPath() string

func LineReader

func LineReader(filePath string) <-chan string

func LogDirPath

func LogDirPath() string

func LogFile

func LogFile(fileName string) (io.Writer, error)

func LogFilePath

func LogFilePath(fileName string) string

func ParseAddress

func ParseAddress(addr string) (proto string, path string, err error)

ParseAddress parses a standard golang network address and returns the protocol and path.

func PidFilePath

func PidFilePath() string

func Prefix

func Prefix(p string)

func RandomString

func RandomString(length int) string

func ReadFileToString

func ReadFileToString(path string) (string, error)

func ReadPidFile

func ReadPidFile() (int, error)

func RunDirPath

func RunDirPath() string

func StdOutAndLogFile

func StdOutAndLogFile(fileName string) (io.Writer, error)

func StringInSlice

func StringInSlice(a string, list []string) bool

func Trim

func Trim(text string) string

Trim removes all leading and trailing whitespace, including tab, newline, and carriage return characters.

func WritePidFile

func WritePidFile(pid int) error

func WriteStringToFile

func WriteStringToFile(text, path string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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