utils

package
v0.0.0-...-b4f3a91 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = &HttpClient{}

Functions

func CollectAllCacheStatus

func CollectAllCacheStatus(runtimePodNames []string, serviceName string) (*v1alpha1.CacheStatus, error)

func ContainsString

func ContainsString(slice []string, s string) bool

ContainsString Determine whether the string array contains a specific string, return true if contains the string and return false if not.

func DiskSpaceOfPaths

func DiskSpaceOfPaths(timeout time.Duration, paths ...string) (map[string]string, error)

func DiskUsageOfPaths

func DiskUsageOfPaths(timeout time.Duration, paths ...string) (string, error)

func FileNumberOfPaths

func FileNumberOfPaths(timeout time.Duration, paths ...string) (string, error)

func Get

func Get(url string, filename types.UID) (resp *http.Response, err error)

func GetBaseUriByIndex

func GetBaseUriByIndex(runtimeName, serviceName string, index int) string

func GetBaseUriByName

func GetBaseUriByName(runtimePodName, serviceName string) string

func GetCacheStatus

func GetCacheStatus(runtimePodName, serviceName string) (*v1alpha1.CacheStatus, error)

func GetHostName

func GetHostName() (string, error)

func GetJobOption

func GetJobOption(option interface{}, filename types.UID, baseUri, optionPath string) error

func GetJobResult

func GetJobResult(filename types.UID, baseUri, resultPath string) (*common.JobResult, error)

func GetOptionUri

func GetOptionUri(baseUri, optionPath string) string

func GetResultUri

func GetResultUri(baseUri, resultPath string) string

func GetRuntimeImage

func GetRuntimeImage() (string, error)

func GetUploadUri

func GetUploadUri(baseUri, uploadPath string) string

func HasDeletionTimestamp

func HasDeletionTimestamp(obj *metav1.ObjectMeta) bool

HasDeletionTimestamp method to check if an object need to delete.

func HasFinalizer

func HasFinalizer(obj *metav1.ObjectMeta, finalizer string) bool

HasFinalizer check

func JuiceFileNumberOfPath

func JuiceFileNumberOfPath(timeout time.Duration, path ...string) (string, error)

func NoRequeue

func NoRequeue() (ctrl.Result, error)

func NoZeroOptionToArgs

func NoZeroOptionToArgs(options interface{}) []string

func NoZeroOptionToMap

func NoZeroOptionToMap(optionMap map[string]reflect.Value, i interface{})

func Post

func Post(url string, filename types.UID, body io.Reader) (resp *http.Response, err error)

func PostJobOption

func PostJobOption(option interface{}, filename types.UID, baseUri, optionPath, param string) error

func RemoveFinalizer

func RemoveFinalizer(obj *metav1.ObjectMeta, finalizer string)

func RemoveString

func RemoveString(slice []string, s string) (result []string)

func RequeueAfter

func RequeueAfter(requeueAfter time.Duration) (ctrl.Result, error)

func RequeueWithError

func RequeueWithError(err error) (ctrl.Result, error)

func WaitFileCreatedWithTimeout

func WaitFileCreatedWithTimeout(ctx context.Context, path string, duration time.Duration) bool

Types

type CacheStatusResult

type CacheStatusResult struct {
	Status *v1alpha1.CacheStatus
	Error  error
}

type HttpClient

type HttpClient struct {
	http.Client
}

func (*HttpClient) Post

func (c *HttpClient) Post(url string, filename types.UID, body io.Reader) (resp *http.Response, err error)

Jump to

Keyboard shortcuts

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