utils

package
v0.0.0-...-83b0e2a Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeFilesOwnership

func ChangeFilesOwnership(iK8sClient interface{}, pods []string, namespace, container, userGroup, cassandraDataDir string) error

ChangeFilesOwnership changes the ownership of files after restoring them

func Contains

func Contains(s []string, e string) bool

Contains checks if a slice contains a given value

func GetBoolEnvVar

func GetBoolEnvVar(name string, defVal bool) bool

GetBoolEnvVar returns the default value if the variable is empty or not true or false, else the value

func GetFloat64EnvVar

func GetFloat64EnvVar(name string, defVal float64) float64

GetFloat64EnvVar returns the default value if the variable is empty, else the value

func GetFromAndToPathsFromK8s

func GetFromAndToPathsFromK8s(iClient interface{}, pods []string, namespace, container, keyspace, tag, dstBasePath, cassandraDataDir string) ([]skbn.FromToPair, error)

GetFromAndToPathsFromK8s aggregates paths from all pods

func GetFromAndToPathsK8sToDst

func GetFromAndToPathsK8sToDst(k8sClient interface{}, namespace, pod, container, keyspace, tag, dstBasePath, cassandraDataDir string) ([]skbn.FromToPair, error)

GetFromAndToPathsK8sToDst performs a path mapping between Kubernetes and a destination

func GetFromAndToPathsSrcToK8s

func GetFromAndToPathsSrcToK8s(srcClient, k8sClient interface{}, srcPrefix, srcPath, srcBasePath, namespace, container, cassandraDataDir string) ([]skbn.FromToPair, []string, []string, error)

GetFromAndToPathsSrcToK8s performs a path mapping between a source and Kubernetes

func GetIntEnvVar

func GetIntEnvVar(name string, defVal int) int

GetIntEnvVar returns 0 if the variable is empty or not int, else the value

func GetPods

func GetPods(iClient interface{}, namespace, selector string) ([]string, error)

GetPods returns a slice of strings of pod names by namespace and selector

func GetRandString

func GetRandString() string

GetRandString returns a randon string

func GetStringEnvVar

func GetStringEnvVar(name, defVal string) string

GetStringEnvVar returns the default value if the variable is empty, else the value

func GetTimeStamp

func GetTimeStamp() string

GetTimeStamp returns time stamp

func MapKeysToSlice

func MapKeysToSlice(m map[string]string) []string

MapKeysToSlice converts a map to a slice using the keys as the values

func PathFromK8sToDst

func PathFromK8sToDst(k8sPath, cassandraDataDir, dstBasePath string) string

PathFromK8sToDst maps a single path from Kubernetes to destination

func PathFromSrcToK8s

func PathFromSrcToK8s(k8sClient interface{}, fromPath, cassandraDataDir, srcBasePath, namespace, container string, pods, tables, testedPaths map[string]string) (string, error)

PathFromSrcToK8s maps a single path from source to Kubernetes

func SliceContainsSlice

func SliceContainsSlice(outers, inners []string) error

SliceContainsSlice verifies that outer slice contains inner slice

func SplitInTwo

func SplitInTwo(s, sep string) (string, string)

SplitInTwo splits a string to two parts by a delimeter

func TestK8sDirectory

func TestK8sDirectory(iK8sClient interface{}, pods []string, namespace, container, cassandraDataDir string) error

TestK8sDirectory checks if a path exists

Types

type BoundedWaitGroup

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

BoundedWaitGroup implements a sized WaitGroup

func NewBoundedWaitGroup

func NewBoundedWaitGroup(cap int) BoundedWaitGroup

NewBoundedWaitGroup initializes a new BoundedWaitGroup

func (*BoundedWaitGroup) Add

func (bwg *BoundedWaitGroup) Add(delta int)

Add performs a WaitGroup Add of a specified delta

func (*BoundedWaitGroup) Done

func (bwg *BoundedWaitGroup) Done()

Done performs a WaitGroup Add of -1

func (*BoundedWaitGroup) Wait

func (bwg *BoundedWaitGroup) Wait()

Wait performs a WaitGroup Wait

Source Files

  • bwg.go
  • env.go
  • general.go
  • kube.go
  • path.go

Jump to

Keyboard shortcuts

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