utils

package
v0.11.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2018 License: Apache-2.0, Apache-2.0 Imports: 22 Imported by: 504

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeviceAttachTimeout

func DeviceAttachTimeout(val string) time.Duration

DeviceAttachTimeout gets the configured device attach timeout.

func GetTempSockFile

func GetTempSockFile(ctx types.Context) string

GetTempSockFile returns a new sock file in a temp space.

func GetTypePkgPathAndName

func GetTypePkgPathAndName(i interface{}) string

GetTypePkgPathAndName gets ths type and package path of the provided instance.

func HostName

func HostName() (string, error)

HostName returns then host name.

func NewBadAdminTokenError

func NewBadAdminTokenError(token string) error

NewBadAdminTokenError returns a new ErrBadAdminToken error.

func NewBadFilterErr

func NewBadFilterErr(filter string, err error) error

NewBadFilterErr returns a new ErrBadFilter error.

func NewBatchProcessErr

func NewBatchProcessErr(completed interface{}, err error) error

NewBatchProcessErr returns a new ErrBatchProcess error.

func NewDriverTypeErr

func NewDriverTypeErr(expectedType, actualType string) error

NewDriverTypeErr returns a new ErrDriverTypeErr error.

func NewMissingInstanceIDError

func NewMissingInstanceIDError(service string) error

NewMissingInstanceIDError returns a new ErrMissingInstanceID error.

func NewMissingLocalDevicesError

func NewMissingLocalDevicesError(service string) error

NewMissingLocalDevicesError returns a new ErrMissingLocalDevices error.

func NewNotFoundError

func NewNotFoundError(resourceID string) error

NewNotFoundError returns a new ErrNotFound error.

func NewPathConfig

func NewPathConfig(args ...string) *types.PathConfig

NewPathConfig returns a new path configuration object.

The args parameter can take zero to three arguments:

  1. The first argument is treated as a custom root, data directory path. This defaults root path is "/".

  2. The second argument is treated as a custom application token. This is used to brand libStorage's paths, files, and environment variables. The default application token is "libstorage".

  3. The third argument is treated as a custom home directory for the executing process's user. The default value is the user's home directory.

func NewStore

func NewStore() types.Store

NewStore initializes a new instance of the Store type.

func NewStoreKeyErr

func NewStoreKeyErr(key string) error

NewStoreKeyErr returns a new ErrStoreKey error.

func NewStoreWithData

func NewStoreWithData(data map[string]interface{}) types.Store

NewStoreWithData initializes a new instance of the Store type.

func NewStoreWithVars

func NewStoreWithVars(vars map[string]string) types.Store

NewStoreWithVars initializes a new instance of the Store type.

func NewTTLStore

func NewTTLStore(duration time.Duration, hardLimit bool) types.Store

NewTTLStore initializes a new instance of the Store type, but has a TTL that expires contents after a specific duration. The parameter hardLimit can be set to true to change the TTL from a sliding expiration to a hard limit.

func NewUnsupportedForClientTypeError

func NewUnsupportedForClientTypeError(
	clientType types.ClientType, op string) error

NewUnsupportedForClientTypeError returns a new ErrUnsupportedForClientType error.

func ParseAuthConfig

func ParseAuthConfig(
	ctx types.Context,
	config gofig.Config,
	fields log.Fields,
	roots ...string) (*types.AuthConfig, error)

ParseAuthConfig returns a new AuthTokenConfig instance.

func ParseKnownHost

func ParseKnownHost(
	ctx types.Context,
	text string) (*types.TLSKnownHost, error)

ParseKnownHost parses a known host line that's in the expected format: "host algorithm fingerprint".

func ParseTLSConfig

func ParseTLSConfig(
	ctx types.Context,
	config gofig.Config,
	proto string,
	fields log.Fields,
	roots ...string) (tlsConfig *types.TLSConfig, tlsErr error)

ParseTLSConfig returns a new TLS configuration.

func SortByString

func SortByString(strings []string) []string

SortByString sorts the strings.

func SortVolumeByID

func SortVolumeByID(volumes []*types.Volume) []*types.Volume

SortVolumeByID sorts the volumes by their IDs.

func WaitFor

func WaitFor(
	f func() (interface{}, error),
	timeout time.Duration) (interface{}, bool, error)

WaitFor waits for a lambda to complete or aborts after a specified amount of time. If the function fails to complete in the specified amount of time then the second return value is a boolean false. Otherwise the return value and possible error of the provided lambda are returned.

Types

type ByString

type ByString []string

ByString implements sort.Interface for []string.

func (ByString) Len

func (a ByString) Len() int

func (ByString) Less

func (a ByString) Less(i, j int) bool

func (ByString) Swap

func (a ByString) Swap(i, j int)

type ByVolumeID

type ByVolumeID []*types.Volume

ByVolumeID implements sort.Interface for []*types.Volume based on the ID field.

func (ByVolumeID) Len

func (a ByVolumeID) Len() int

func (ByVolumeID) Less

func (a ByVolumeID) Less(i, j int) bool

func (ByVolumeID) Swap

func (a ByVolumeID) Swap(i, j int)

type LoggingConfig

type LoggingConfig struct {

	// Level is the log level.
	Level log.Level

	// Stdout is the path to the file to which to log stdout.
	Stdout string

	// Stderr is the path to the file to which to log stderr.
	Stderr string

	// HTTPRequests is a flag indicating whether or not to log HTTP requests.
	HTTPRequests bool

	// HTTPResponses is a flag indicating whether or not to log HTTP responses.
	HTTPResponses bool
}

LoggingConfig is the logging configuration.

func ParseLoggingConfig

func ParseLoggingConfig(
	config gofig.Config,
	fields log.Fields,
	roots ...string) (*LoggingConfig, error)

ParseLoggingConfig returns a new LoggingConfig instance.

Directories

Path Synopsis
Package filters is a piece of thievery as the LDAP filter parsing code was lifted serepticiously from https://github.com/tonnerre/go-ldap/blob/master/ldap.go.
Package filters is a piece of thievery as the LDAP filter parsing code was lifted serepticiously from https://github.com/tonnerre/go-ldap/blob/master/ldap.go.

Jump to

Keyboard shortcuts

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