utils

package
v0.0.0-...-4e63163 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2016 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const PosixPathMax = C._POSIX_PATH_MAX

PosixPathMax represents C's POSIX_PATH_MAX

Variables

View Source
var (
	PathMax     = unix.PathMax
	Removexattr = unix.Removexattr
	Setxattr    = unix.Setxattr
	Getxattr    = unix.Getxattr
)

Functions

func CheckProcessExist

func CheckProcessExist(pid int) bool

Function to check whether the process with given pid exist or not in the system

func GetDeviceID

func GetDeviceID(f os.FileInfo) (int, error)

GetDeviceID fetches the device id of the device containing the file/directory

func GetJSONFromRequest

func GetJSONFromRequest(r *http.Request, v interface{}) error

GetJSONFromRequest unmarshals JSON in `r` into `v`

func GetJSONFromResponse

func GetJSONFromResponse(r *http.Response, v interface{}) error

GetJSONFromResponse unmarshals JSON in `r` into `v`

func InitDir

func InitDir(dir string)

InitDir checks if the input directory is present, a direcotry and is accessible. @ If the directory is not present, it will create directory. @ If it is not a directory, initDir panics. @ If the directory is not accessible, initDir panics.

func IsLocalAddress

func IsLocalAddress(host string) (bool, error)

IsLocalAddress checks whether a given host/IP is local

func ParseHostAndBrickPath

func ParseHostAndBrickPath(brickPath string) (string, string, error)

ParseHostAndBrickPath parses the host & brick path out of req.Bricks list

func ValidateBrickPathLength

func ValidateBrickPathLength(brickPath string) error

ValidateBrickPathLength validates the length of the brick path

func ValidateBrickPathStats

func ValidateBrickPathStats(brickPath string, host string, force bool) error

ValidateBrickPathStats checks whether the brick directory can be created with certain validations like directory checks, whether directory is part of mount point etc

func ValidateBrickSubDirLength

func ValidateBrickSubDirLength(brickPath string) error

ValidateBrickSubDirLength validates the length of each sub directories under the brick path

func ValidateXattrSupport

func ValidateXattrSupport(brickPath string, host string, uuid uuid.UUID, force bool) error

ValidateXattrSupport checks whether the underlying file system has extended attribute support and it also sets some internal xattrs to mark the brick in use

Types

This section is empty.

Jump to

Keyboard shortcuts

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