file

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	FILE_DELIMITER = ","
	YAML_SEPARATOR = "#---#"
	FILE_POSTFIX   = "-generated.yml"
	PATH_DELIMITER = "/"
	MAP_DELIMITER  = "="
	TraceFolder    = "composetrace"
)

Variables

This section is empty.

Functions

func AppendElement

func AppendElement(i interface{}, old string, new string) interface{}

AppendElement does append element in array/map Element will be overwrite if it already exist Using regular expression to match the element

func CheckFileExist

func CheckFileExist(file string) bool

check if file exist

func ConvertArrayToMap

func ConvertArrayToMap(arr []interface{}) map[interface{}]interface{}

Convert array like a=b to map a:b

func ConvertMapToArray

func ConvertMapToArray(m map[interface{}]interface{}) []interface{}

func CopyDir

func CopyDir(source string, dest string) (err error)

func CopyFile

func CopyFile(source string, dest string) (err error)

func CreateMapValuesArray

func CreateMapValuesArray(m map[string][]*types.StepData) []interface{}

CreateMapValuesArray creates an interface array of all the values of the given map examples: Map= {"1":"a", "2":"b", "3":"c"} array returned will be: ["a", "b", "c"]

func DeFolderPath

func DeFolderPath(filepaths []string) []string

func DeleteFile

func DeleteFile(file string) error

func DumpPluginModifiedComposeFiles

func DumpPluginModifiedComposeFiles(plugin, funcName string, pluginOrder int)

func FolderPath

func FolderPath(filenames []string) []string

func FormatInterfaceArray

func FormatInterfaceArray(s []string) []interface{}

[]string to []interface{}

func GenerateAppFolder

func GenerateAppFolder() error

GenerateAppFolder does generate app folder and copy compose files exist in fileName label into folder

func GenerateFileDirs

func GenerateFileDirs(paths []string) error

generate directories

func GetDirFilesRecv

func GetDirFilesRecv(dir string, files *[]string)

Get path compose file Since user may upload a tar ball which including all the compose files. In case they have different depth of folders to keep compose files, GetDirFilesRecv help to get the complete path of compose file

func GetFiles

func GetFiles(taskInfo *mesos.TaskInfo) ([]string, error)

Get required file list from label of fileName in taskInfo

func GetPluginOrder

func GetPluginOrder(taskInfo *mesos.TaskInfo) ([]string, error)

Get plugin order from label of pluginorder in taskInfo

func GetYAML

func GetYAML(taskInfo *mesos.TaskInfo) []string

Get downloaded file paths from uris

func IndexArray

func IndexArray(array []string, element string) int

get index of an element in array

func IndexArrayRegex

func IndexArrayRegex(array []interface{}, expr string) (int, error)

func IsSubset

func IsSubset(first, second []string) bool

check if "first" is subset of "second"

func OverwriteFile

func OverwriteFile(file string, data []byte) error

func ParseYamls

func ParseYamls(files *[]string) (map[string]map[string]interface{}, error)

func PrefixTaskId

func PrefixTaskId(taskId string, session string) string

Add taskId as prefix

func ReplaceElement

func ReplaceElement(i interface{}, old string, new string) interface{}

ReplaceElement does replace element in array/map

func SearchFile

func SearchFile(root, file string) string

search a file return path of a file

func SearchInArray

func SearchInArray(array []interface{}, key string) string

func SplitFunc

func SplitFunc(data []byte, atEOF bool) (advance int, token []byte, err error)

splitYAMLDocument is a bufio.SplitFunc for splitting YAML streams into individual documents. This SplitFunc code is from K8s utils, since the yaml serperator is different, it can't be reused directly.

func SplitYAML

func SplitYAML(file string) ([]string, error)

Split a large file into a number of smaller files by file separator

func WriteChangeToFiles

func WriteChangeToFiles() error

func WriteToFile

func WriteToFile(file string, data []byte) (string, error)

Generate file with provided name and write data into it.

Types

type EditorFunc

type EditorFunc func(serviceName string, taskInfo *mesos.TaskInfo, executorId string, taskId string, containerDetails map[interface{}]interface{}, ports *list.Element) (map[interface{}]interface{}, *list.Element, error)

Jump to

Keyboard shortcuts

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