cliutils

package module
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 21 Imported by: 0

README

English | 简体中文

Guance Cloud cliutils

This library mainly collects various common functional packages in the Guance Cloud. See the README of each package for details.

GoDoc MIT License

Documentation

Overview

Package cliutils host all public-used golang utils/tools/libs for Guance Cloud.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOssFileTooLarge = errors.New(`oss file too large`)

	DefaultPartSize = int64(32 * 1024 * 1024) //nolint:gomnd // 32MB
	DefaultTimeout  = uint(30)                //nolint:gomnd // seconds
	DefaultWorkers  = 8
)

Functions

func CreateRandomString

func CreateRandomString(n int) string

func Decrypt

func Decrypt(endata, phrase []byte) ([]byte, error)

func Encrypt

func Encrypt(data, phrase []byte) ([]byte, error)

func GZip

func GZip(data []byte) ([]byte, error)

func GZipStr

func GZipStr(str string) ([]byte, error)

func LeftStringTrim

func LeftStringTrim(s string, n int) string

func Md5Hash

func Md5Hash(data []byte) string

func MustGZip

func MustGZip(data []byte) []byte

func PromTextToMetrics

func PromTextToMetrics(data io.Reader, measurementPrefix, defaultMeasurement string, t time.Time) ([]*ifxcli.Point, error)

func SizeFmt

func SizeFmt(n int64) string

func StringTrim

func StringTrim(s string, n int) string

func WgWait

func WgWait(wg *sync.WaitGroup, timeout int)

func XID

func XID(p string) string

Types

type OssCli

type OssCli struct {
	Host, AccessKey, SecretKey, BucketName, WorkDir string
	Timeout                                         uint
	PartSize                                        int64
	Workers                                         int

	ReconnectCnt  int
	FailedCnt     int
	UploadedFiles int
	UploadedBytes int64
	// contains filtered or unexported fields
}

func (*OssCli) Download

func (oc *OssCli) Download(obj, to string) error

func (*OssCli) GetMeta

func (oc *OssCli) GetMeta(obj string) (map[string][]string, error)

func (*OssCli) Init

func (oc *OssCli) Init() error

func (*OssCli) ListObjects

func (oc *OssCli) ListObjects(prefix, marker string, maxKeys int) (oss.ListObjectsResult, error)

func (*OssCli) Move

func (oc *OssCli) Move(from, to string) error

func (*OssCli) Reconnect

func (oc *OssCli) Reconnect() error

func (*OssCli) SetMeta

func (oc *OssCli) SetMeta(obj string, meta map[string]string) error

func (*OssCli) Stat

func (oc *OssCli) Stat() string

func (*OssCli) Upload

func (oc *OssCli) Upload(from, to string) error

type Sem

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

func NewSem

func NewSem() *Sem

func (*Sem) Close

func (s *Sem) Close()

func (*Sem) Wait

func (s *Sem) Wait() <-chan interface{}

Directories

Path Synopsis
Package cache wraps wal to handle local disk cache.
Package cache wraps wal to handle local disk cache.
cmd
Package dialtesting defined dialtesting tasks and task implements.
Package dialtesting defined dialtesting tasks and task implements.
Package diskcache is a simple local-disk cache implements.
Package diskcache is a simple local-disk cache implements.
Code generated by goyacc -l -o gram_y.go gram.y.
Code generated by goyacc -l -o gram_y.go gram.y.
Package lineproto wraps influxdb lineprotocol.
Package lineproto wraps influxdb lineprotocol.
Package logger wrapped zap as a basic logging implement.
Package logger wrapped zap as a basic logging implement.
Package metrics implements datakit's Prometheus metrics
Package metrics implements datakit's Prometheus metrics
Package network wraps basic network related implements.
Package network wraps basic network related implements.
http
Package http wraps all HTTP releated common-used utils.
Package http wraps all HTTP releated common-used utils.
ws
Package ws wraps websocket implements among UNIX-like(Linux & macOS) platform
Package ws wraps websocket implements among UNIX-like(Linux & macOS) platform
Package pipeline implement pipeline.
Package pipeline implement pipeline.
manager
Package manager for managing pipeline scripts
Package manager for managing pipeline scripts
manager/relation
Package relation record source-name relation
Package relation record source-name relation
offload
Package offload offload data to other data sinks
Package offload offload data to other data sinks
ptinput
Package ptinput impl ppl input interface
Package ptinput impl ppl input interface
ptinput/funcs
Package funcs for pipeline
Package funcs for pipeline
ptinput/ipdb
Package ipdb define the interface for ip location or isp.
Package ipdb define the interface for ip location or isp.
ptinput/ipdb/geoip
Package geoip implement ipdb.
Package geoip implement ipdb.
ptinput/ipdb/iploc
Package iploc implement ipdb.
Package iploc implement ipdb.
ptinput/plcache
Package plcache implements cache in pipeline
Package plcache implements cache in pipeline
ptinput/plmap
Package plmap used to store data during pl script execution
Package plmap used to store data during pl script execution
ptinput/refertable
Package refertable for saving external data
Package refertable for saving external data
ptinput/utils
Package utils wraps utilities used by pipeline
Package utils wraps utilities used by pipeline
stats
Package stats used to record pl metrics
Package stats used to record pl metrics
pkg
hash
Package hash used to calculate hash
Package hash used to calculate hash
Package point implements datakits basic data structure.
Package point implements datakits basic data structure.
pb
test
Package main used for GC escape:
Package main used for GC escape:
Package system used to wrap basic system related settings.
Package system used to wrap basic system related settings.
rtpanic
Package rtpanic wraps panic handling during golang app panic.
Package rtpanic wraps panic handling during golang app panic.
Package testutil wraps basic tools when building goalng test cases.
Package testutil wraps basic tools when building goalng test cases.
Package tracer defined basic trace wraps.
Package tracer defined basic trace wraps.

Jump to

Keyboard shortcuts

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