Documentation
¶
Index ¶
- Constants
- func AdvancedDivide[T numbers](a, b T) T
- func Any[T any](slice []T, f func(T) bool) bool
- func Bool2Int(a bool) int
- func CleanStatsdMetrics(k string) string
- func DecodeMetaInLabel(ctx context.Context, labels map[string]string) *types.LabelMeta
- func DecodePublishInfo(info map[string]string) map[string][]string
- func EncodeMetaInLabel(ctx context.Context, meta *types.LabelMeta) string
- func EncodePublishInfo(info map[string][]string) map[string]string
- func EnsureReaderClosed(ctx context.Context, stream io.ReadCloser)
- func Filter[T any](slice []T, f func(T) bool) []T
- func GenerateSlice[T any](l int, factory func() T) []T
- func GetGitRepoName(url string) (string, error)
- func GetHTTPClient() *http.Client
- func GetHTTPSClient(ctx context.Context, certPath, name, ca, cert, key string) (client *http.Client, err error)
- func GetOutboundAddress(bind string, probeTarget string) (string, error)
- func GetTag(image string) string
- func GetUnixSockClient() *http.Client
- func InheritTracingInfo(ctx, newCtx context.Context) context.Context
- func LabelsFilter(extend map[string]string, labels map[string]string) bool
- func ListAllExecutableFiles(basedir string) ([]string, error)
- func ListAllSharedLibFiles(basedir string) ([]string, error)
- func LoadConfig(configPath string) (types.Config, error)
- func MakeCommandLineArgs(s string) []string
- func MakePublishInfo(networks map[string]string, ports []string) map[string][]string
- func MakeWorkloadName(appname, entrypoint, ident string) string
- func Map[T1, T2 any](slice []T1, f func(T1) T2) []T2
- func Max[T constraints.Ordered](x T, xs ...T) T
- func MergeHookOutputs(outputs []*bytes.Buffer) []byte
- func Min[T constraints.Ordered](x T, xs ...T) T
- func NewInheritCtx(ctx context.Context) context.Context
- func NewPool(max int) (*ants.PoolWithFunc, error)
- func NormalizeImageName(image string) string
- func PCR(ctx context.Context, prepare func(ctx context.Context) error, ...) error
- func ParseRAMInHuman(ram string) (int64, error)
- func ParseWorkloadName(workloadName string) (string, string, string, error)
- func RandomString(n int) string
- func Range(n int) (res []int)
- func Reverse[T any](s []T)
- func Round(f float64) float64
- func SHA256(input string) string
- func SentryGo(f func())
- func ShortID(workloadID string) string
- func Sum[T numbers](slice []T) T
- func Tail(path string) string
- func TempFile(stream io.ReadCloser) (string, error)
- func Txn(ctx context.Context, cond contextFunc, then contextFunc, ...) (txnErr error)
- func Unique[T, E constraints.Ordered](s []T, getVal func(int) E) (j int)
- func WithTimeout(ctx context.Context, timeout time.Duration, f func(context.Context))
Constants ¶
const (
// DefaultVersion for default version
DefaultVersion = "latest"
)
Variables ¶
This section is empty.
Functions ¶
func CleanStatsdMetrics ¶
CleanStatsdMetrics trans dot to _
func DecodeMetaInLabel ¶
DecodeMetaInLabel get meta from label and decode it
func DecodePublishInfo ¶
DecodePublishInfo decode publish info
func EncodeMetaInLabel ¶
EncodeMetaInLabel encode meta to json
func EncodePublishInfo ¶
EncodePublishInfo encode publish info
func EnsureReaderClosed ¶
func EnsureReaderClosed(ctx context.Context, stream io.ReadCloser)
EnsureReaderClosed As the name says, blocks until the stream is empty, until we meet EOF
func GenerateSlice ¶
GenerateSlice generates a slice with factory function
func GetGitRepoName ¶
GetGitRepoName return git repo name
func GetHTTPSClient ¶
func GetHTTPSClient(ctx context.Context, certPath, name, ca, cert, key string) (client *http.Client, err error)
GetHTTPSClient returns an HTTPS client if cert_path/ca/cert/key is empty, it returns an HTTP client instead
func GetOutboundAddress ¶
GetOutboundAddress finds out self-service address
func InheritTracingInfo ¶
InheritTracingInfo pass through the tracing info: peer, tracing id
func LabelsFilter ¶
LabelsFilter filter workload by labels
func ListAllExecutableFiles ¶
ListAllExecutableFiles returns all the executable files in the given path
func ListAllSharedLibFiles ¶
func LoadConfig ¶
LoadConfig load config from yaml
func MakeCommandLineArgs ¶
MakeCommandLineArgs make command line args
func MakePublishInfo ¶
MakePublishInfo generate publish info
func MakeWorkloadName ¶
MakeWorkloadName joins appname, entrypoint, ident using '_'
func MergeHookOutputs ¶
MergeHookOutputs merge hooks output
func NewInheritCtx ¶
NewInheritCtx new a todo context and get the previous values
func NormalizeImageName ¶
NormalizeImageName will normalize image name
func PCR ¶
func PCR(ctx context.Context, prepare func(ctx context.Context) error, commit func(ctx context.Context) error, rollback func(ctx context.Context) error, ttl time.Duration) error
PCR Prepare, Commit, Rollback. `prepare` should be a pure calculation process without side effects. `commit` writes the calculation result of `prepare` into database. if `commit` returns error, `rollback` will be performed.
func ParseRAMInHuman ¶
ParseRAMInHuman returns int value in bytes of a human readable string e.g. 100KB -> 102400
func ParseWorkloadName ¶
ParseWorkloadName does the opposite thing as MakeWorkloadName
func Txn ¶
func Txn(ctx context.Context, cond contextFunc, then contextFunc, rollback func(context.Context, bool) error, ttl time.Duration) (txnErr error)
Txn provides unified API to perform txn
Types ¶
This section is empty.