utils

package
v0.0.0-...-b7e2043 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: UPL-1.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DebugEnabled defines if debugging is enabled
	DebugEnabled bool

	// Logger is the logger to use for writing logs
	Logger *zap.Logger

	// ErrPort indicates an invalid port value
	ErrPort = errors.New("port must be between 1024 and 65535")
)

Functions

func CombineByteArraysForJSON

func CombineByteArraysForJSON(elements [][]byte, elementName []string) ([]byte, error)

CombineByteArraysForJSON combines byte arrays for json output

func DirectoryExists

func DirectoryExists(directory string) bool

DirectoryExists returns a bool indicating if a directory exists.

func EnsureDirectory

func EnsureDirectory(directory string) error

EnsureDirectory ensures a directory exists and if not then will create it.

func GetCoherenceMainClass

func GetCoherenceMainClass(_ string) string

GetCoherenceMainClass returns the default startup class for the specified Coherence version. In the future this may be automatically determined but default to coherenceMain.

func GetError

func GetError(message string, err error) error

GetError returns a formatted error and prints to log.

func GetErrors

func GetErrors(errorList []error) error

GetErrors return an error containing either the single error or an error indicating there are multiple errors in the log.

func GetJSONPathResults

func GetJSONPathResults(jsonData []byte, jsonPath string) (string, error)

GetJSONPathResults returns jsonapth results.

func GetSliceIndex

func GetSliceIndex(theSlice []string, value string) int

GetSliceIndex returns the index of the matching slice value.

func GetStartupDelayInMillis

func GetStartupDelayInMillis(startupDelay string) (int64, error)

GetStartupDelayInMillis returns the startup delay in millis converted from the following suffixes: ms = millis - eg. 10ms s = seconds ed 5s no suffix is millis.

func GetStorageMap

func GetStorageMap(storage config.StorageDetails) map[int]bool

GetStorageMap returns a map by node Id indicating if the node is storage enabled.

func GetUniqueValues

func GetUniqueValues(input []string) []string

GetUniqueValues returns the slice of unique values.

func IsDistributedCache

func IsDistributedCache(serviceType string) bool

IsDistributedCache returns true if the service type is distributed.

func IsStorageEnabled

func IsStorageEnabled(nodeID int, storageMap map[int]bool) bool

IsStorageEnabled returns true or false.

func IsValidInt

func IsValidInt(value string) bool

IsValidInt returns true or false indicating if a string int is a valid integer.

func ProcessJSONPath

func ProcessJSONPath(jsonData interface{}, jsonPathQuery string) ([]byte, error)

ProcessJSONPath parses json path expression on Json and returns the json.

func SanitizeSnapshotName

func SanitizeSnapshotName(snapshotName string) string

SanitizeSnapshotName sanitizes a snapshot name by replacing any unwanted characters with '-'.

func SliceContains

func SliceContains(theSlice []string, value string) bool

SliceContains returns true of the slice contains the value.

func ValidatePort

func ValidatePort(port int32) error

ValidatePort validates that a port is valid.

func ValidateStartClass

func ValidateStartClass(startClass string) error

ValidateStartClass validates that the server start class is and empty string, and therefore use the default, or a valid option.

Types

This section is empty.

Jump to

Keyboard shortcuts

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