utils

package
v4.13.10 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0, Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CleanupInterval = 24 * time.Hour
)

Variables

This section is empty.

Functions

func AddDrpParam

func AddDrpParam(c *api.Client, objtype, objkey, param string, new interface{}) *models.Error

func AddOrSetDrpParam

func AddOrSetDrpParam(c *api.Client, objtype, objkey, param string, new interface{}) *models.Error

func AddToJobLog

func AddToJobLog(c *api.Client, jid, data string) *models.Error

func ConvertError

func ConvertError(code int, err error) *models.Error

func DeleteDrpMachine

func DeleteDrpMachine(c *api.Client, uuid string) *models.Error

func GetDrpBooleanParam

func GetDrpBooleanParam(c *api.Client, objtype, objkey, param string) (bool, *models.Error)

func GetDrpIntParam

func GetDrpIntParam(c *api.Client, objtype, objkey, param string) (int, *models.Error)

func GetDrpMachineByParam

func GetDrpMachineByParam(c *api.Client, param, value string) (*models.Machine, *models.Error)

func GetDrpObjByParam

func GetDrpObjByParam(c *api.Client, objtype, param, value string) (models.Model, *models.Error)

func GetDrpParam

func GetDrpParam(c *api.Client, objtype, objkey, param string) (interface{}, *models.Error)

* Helper function to lookup an object's parameter in aggregate so that * the parameter default could be retrieved if unset.

func GetDrpStringParam

func GetDrpStringParam(c *api.Client, objtype, objkey, param string) (string, *models.Error)

func GetJobById added in v4.12.0

func GetJobById(c *api.Client, jid string) (*models.Job, *models.Error)

func GetParamOrBoolean

func GetParamOrBoolean(m map[string]interface{}, p string, b bool) bool

func GetParamOrInt

func GetParamOrInt(m map[string]interface{}, p string, i int) int

func GetParamOrInt64

func GetParamOrInt64(m map[string]interface{}, p string, i int64) int64

func GetParamOrString

func GetParamOrString(m map[string]interface{}, p, s string) string

func MakeError

func MakeError(code int, msg string) *models.Error

func Package added in v4.11.0

func Package(target, src string) error

func RemoveDrpParam

func RemoveDrpParam(c *api.Client, objtype, objkey, param string, old interface{}) *models.Error

func SetDrpParam

func SetDrpParam(c *api.Client, objtype, objkey, param string, old, new interface{}) *models.Error

func SetErrorName

func SetErrorName(name string)

func Unpack added in v4.11.0

func Unpack(src []byte, target string) error

func ValidateBooleanValue

func ValidateBooleanValue(param string, val interface{}) (bool, *models.Error)

func ValidateIntValue

func ValidateIntValue(param string, val interface{}) (int, *models.Error)

func ValidateStringValue

func ValidateStringValue(param string, val interface{}) (string, *models.Error)

Types

type Cache added in v4.11.15

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

func CreateCache added in v4.11.15

func CreateCache(secretTtl time.Duration, getData func(string, string) (interface{}, *models.Error)) *Cache

func (*Cache) ClearMachineCache added in v4.11.15

func (c *Cache) ClearMachineCache(machineId string)

func (*Cache) Empty added in v4.11.15

func (c *Cache) Empty()

Empty: empties the contents of the cache

func (*Cache) Get added in v4.11.15

func (c *Cache) Get(machineId string, lookupUri string) (interface{}, error)

type PerIdQueue

type PerIdQueue struct {
	Capacity int
	// contains filtered or unexported fields
}

func NewQueues

func NewQueues(ctx context.Context, limit int) *PerIdQueue

func (*PerIdQueue) Add

func (pmq *PerIdQueue) Add(id string, l logger.Logger, req func()) error

Jump to

Keyboard shortcuts

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