common

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StoppedState = iota + 1
	RunningState
	StoppingState
)

Variables

View Source
var (
	InvalidPortRange = errors.New("Invalid port range")
	NoPortLeft       = errors.New("No free port left")
)
View Source
var (
	CantCompareInterface = errors.New("Can't compare interface")
	ErrFieldNotFound     = errors.New("Field not found")
)
View Source
var (
	CaptureTypes = map[string]CaptureType{}
)

Functions

func CrossTypeCompare added in v0.5.0

func CrossTypeCompare(a interface{}, b interface{}) (int, error)

func CrossTypeEqual

func CrossTypeEqual(a interface{}, b interface{}) bool

func IPToString added in v0.8.0

func IPToString(ip net.IP) string

func IPv6Supported added in v0.8.0

func IPv6Supported() bool

func IsCaptureAllowed added in v0.5.0

func IsCaptureAllowed(nodeType string) bool

func JsonDecode added in v0.10.0

func JsonDecode(r io.Reader, i interface{}) error

func MaxInt64

func MaxInt64(a, b int64) int64

func MinInt64

func MinInt64(a, b int64) int64

func Retry

func Retry(fnc func() error, try int, delay time.Duration) error

Retry tries to execute the given function until a success applying a delay between each try

func ToFloat64 added in v0.8.0

func ToFloat64(f interface{}) (float64, error)

func ToInt64 added in v0.8.0

func ToInt64(i interface{}) (int64, error)

func UnixMillis added in v0.10.0

func UnixMillis(t time.Time) int64

Types

type CaptureType added in v0.7.0

type CaptureType struct {
	Allowed []string
	Default string
}

type Iterator added in v0.6.0

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

func NewIterator added in v0.6.0

func NewIterator(values ...int64) (it *Iterator)

func (*Iterator) Done added in v0.6.0

func (it *Iterator) Done() bool

func (*Iterator) Next added in v0.6.0

func (it *Iterator) Next() bool

type Metric added in v0.10.0

type Metric interface {
	GetField(field string) (int64, error)
	Add(m Metric) Metric
}

type NetNSContext added in v0.8.0

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

func NewNetNsContext added in v0.8.0

func NewNetNsContext(path string) (*NetNSContext, error)

func (*NetNSContext) Close added in v0.8.0

func (n *NetNSContext) Close()

func (*NetNSContext) Quit added in v0.8.0

func (n *NetNSContext) Quit() error

type PortAllocator added in v0.10.0

type PortAllocator struct {
	sync.RWMutex
	MinPort int
	MaxPort int
	PortMap map[int]interface{}
}

func NewPortAllocator added in v0.10.0

func NewPortAllocator(min, max int) (*PortAllocator, error)

func (*PortAllocator) Allocate added in v0.10.0

func (p *PortAllocator) Allocate() (int, error)

func (*PortAllocator) Release added in v0.10.0

func (p *PortAllocator) Release(i int)

func (*PortAllocator) ReleaseAll added in v0.10.0

func (p *PortAllocator) ReleaseAll()

func (*PortAllocator) Set added in v0.10.0

func (p *PortAllocator) Set(i int, obj interface{})

type ServiceAddress added in v0.10.0

type ServiceAddress struct {
	Addr string
	Port int
}

func ServiceAddressFromString added in v0.10.0

func ServiceAddressFromString(addressPort string) (ServiceAddress, error)

type ServiceType added in v0.10.0

type ServiceType string
const (
	AnalyzerService ServiceType = "analyzer"
	AgentService    ServiceType = "agent"
)

func (ServiceType) String added in v0.10.0

func (st ServiceType) String() string

type SortOrder added in v0.10.0

type SortOrder string
const (
	SortAscending  SortOrder = "ASC"
	SortDescending SortOrder = "DESC"
)

type TimeSlice added in v0.10.0

type TimeSlice struct {
	Start int64 `json:"Start"`
	Last  int64 `json:"Last"`
}

func NewTimeSlice added in v0.10.0

func NewTimeSlice(s, l int64) *TimeSlice

type TimedMetric added in v0.10.0

type TimedMetric struct {
	TimeSlice
	Metric Metric
}

func (*TimedMetric) GetField added in v0.10.0

func (tm *TimedMetric) GetField(field string) (int64, error)

func (*TimedMetric) MarshalJSON added in v0.10.0

func (tm *TimedMetric) MarshalJSON() ([]byte, error)

Source Files

  • capture.go
  • common.go
  • iterator.go
  • ns.go
  • port_allocator.go
  • service.go
  • types.go

Jump to

Keyboard shortcuts

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