Documentation ¶
Index ¶
- func GetHashCode(i interface{}) string
- func GetLastChunkOfSlashed(s string) string
- func GetResourceKey(namespace, name string) string
- func ParseNamespacedName(namespacedName string) (string, string, error)
- func PrettyJSON(js []byte, prefix string) ([]byte, error)
- func RandStringRunes(n int) string
- func RemoveDuplicateStrings(list []string) []string
- func Retry(totalRetryCount int, retryPause time.Duration, ...) (err error)
- func SaveToFile(fileName string, content []byte) (string, error)
- type Retriable
- type RetriableFunction
- type ThreadsafeMultiMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHashCode ¶
func GetHashCode(i interface{}) string
GetHashCode generates hashcode of given type
func GetLastChunkOfSlashed ¶
GetLastChunkOfSlashed splits a string by slash and returns the last chunk.
func GetResourceKey ¶
GetResourceKey generates the key in k8s format for a given resource
func PrettyJSON ¶
PrettyJSON Unmarshals and Marshall again with Indent so it is human readable
func RandStringRunes ¶
RandStringRunes generates n length random string
func RemoveDuplicateStrings ¶
RemoveDuplicates returns a copy of a slice with duplicates removed
func Retry ¶
func Retry(totalRetryCount int, retryPause time.Duration, retriableFunction RetriableFunction) (err error)
Retry retries retriableFunction for totalRetryCount times with a gap of retryPause. if retriableFunction returns boolean as false, then Retry will not retry and return error if retriableFunction returns boolean as true, then Retry will retry if fn returned an error if totalRetryCount is -1, then retry happen forever until one of the two above conditions are satisfied.
Types ¶
type Retriable ¶
type Retriable bool
Retriable is returned by RetriableFunction and tells whether to retry the function or not.
type RetriableFunction ¶
RetriableFunction is function that can be retried
type ThreadsafeMultiMap ¶
type ThreadsafeMultiMap interface { Insert(key interface{}, value interface{}) Clear(key interface{}) Erase(key interface{}) bool EraseValue(value interface{}) bool ContainsPair(key interface{}, value interface{}) bool ContainsValue(value interface{}) bool }
ThreadsafeMultiMap is a thread safe implementation of a multimap.
func NewThreadsafeMultimap ¶
func NewThreadsafeMultimap() ThreadsafeMultiMap
NewThreadsafeMultimap creates a ThreadsafeMultiMap.