util

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToSize

func BytesToSize(sz int64) string

func DiscoverMetrics

func DiscoverMetrics(root string) (map[string]*MetricsId, error)

func ReadInt32

func ReadInt32(buf []byte) (v int32)

func ReadInt64

func ReadInt64(buf []byte) (v int64)

func ReadSamples

func ReadSamples(path string) (data map[int64]int64, err error)

func ReadUint16

func ReadUint16(buf []byte) (v uint16)

func ReadUint32

func ReadUint32(buf []byte) (v uint32)

func WriteInt32

func WriteInt32(buf []byte, v int32)

func WriteInt64

func WriteInt64(buf []byte, v int64)

func WriteMetricsId

func WriteMetricsId(id, outPath string, values map[string]string) error

func WriteSamples

func WriteSamples(name, outPath string, samples []*Sample) error

func WriteUint16

func WriteUint16(buf []byte, v uint16)

func WriteUint32

func WriteUint32(buf []byte, v uint32)

Types

type CtrlHandler added in v0.3.5

type CtrlHandler func(string, net.Conn) (int64, error)

type CtrlListener

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

func GetCtrlListener

func GetCtrlListener(root, id string) (cl *CtrlListener, err error)

func (*CtrlListener) AddCallback

func (self *CtrlListener) AddCallback(keyword string, f CtrlHandler)

func (*CtrlListener) Start

func (self *CtrlListener) Start()

type MetricsId

type MetricsId struct {
	Id     string            `json:"id"`
	Values map[string]string `json:"values,omitempty"`
}

func ReadMetricsId

func ReadMetricsId(path string) (*MetricsId, error)

type Sample

type Sample struct {
	Ts time.Time
	V  int64
}

type Sequence

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

func NewSequence

func NewSequence(nextValue int32) *Sequence

func (*Sequence) Next

func (self *Sequence) Next() int32

func (*Sequence) ResetTo

func (self *Sequence) ResetTo(nextValue int32)

Jump to

Keyboard shortcuts

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