models

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoRecord error.
	ErrNoRecord = errors.New("models: no matching record found")

	// ErrInvalidLimit error.
	ErrInvalidLimit = errors.New("models: invalid limit")
)

Functions

This section is empty.

Types

type Alarm added in v1.4.0

type Alarm struct {
	CPU    float64 `redis:"cpu"`
	Memory float64 `redis:"memory"`
	Disk   float64 `redis:"disk"`
}

Alarm type.

type AlarmRepository added in v1.4.0

type AlarmRepository interface {
	Find(Probe) (*Alarm, error)
}

AlarmRepository type.

type Probe added in v1.5.0

type Probe string

Probe type.

type ProbeRepository added in v1.5.0

type ProbeRepository interface {
	FindAll() ([]Probe, error)
	FindLatestValues(Probe, int) ([]interface{}, *time.Time, error)
	HasHeartbeat(Probe) (bool, error)
	SetHeartbeat(Probe, int) error
	Delete(Probe) error
}

ProbeRepository type.

type RedisAlarmRepository added in v1.4.0

type RedisAlarmRepository struct {
	RedisPool *redis.Pool
}

RedisAlarmRepository type.

func (*RedisAlarmRepository) Find added in v1.4.0

func (rar *RedisAlarmRepository) Find(probe Probe) (*Alarm, error)

Find function.

type RedisProbeRepository added in v1.5.0

type RedisProbeRepository struct {
	RedisPool *redis.Pool
}

RedisProbeRepository type.

func (*RedisProbeRepository) Delete added in v1.9.0

func (rpr *RedisProbeRepository) Delete(probe Probe) error

Delete function.

func (*RedisProbeRepository) FindAll added in v1.5.0

func (rpr *RedisProbeRepository) FindAll() ([]Probe, error)

FindAll function.

func (*RedisProbeRepository) FindLatestValues added in v1.8.0

func (rpr *RedisProbeRepository) FindLatestValues(probe Probe, limit int) ([]interface{}, *time.Time, error)

FindLatestValues function.

func (*RedisProbeRepository) HasHeartbeat added in v1.8.0

func (rpr *RedisProbeRepository) HasHeartbeat(probe Probe) (bool, error)

HasHeartbeat function.

func (*RedisProbeRepository) SetHeartbeat added in v1.8.0

func (rpr *RedisProbeRepository) SetHeartbeat(probe Probe, sleep int) error

SetHeartbeat function.

type RedisSeriesRepository

type RedisSeriesRepository struct {
	RedisPool *redis.Pool
}

RedisSeriesRepository type.

func (*RedisSeriesRepository) ChunkSize added in v1.6.1

func (rsr *RedisSeriesRepository) ChunkSize(seriesType SeriesType) int

ChunkSize function.

func (*RedisSeriesRepository) FindCPU

func (rsr *RedisSeriesRepository) FindCPU(probe Probe, seriesType SeriesType) (Series, Series, Series, error)

FindCPU function.

func (*RedisSeriesRepository) FindDisk

func (rsr *RedisSeriesRepository) FindDisk(probe Probe, seriesType SeriesType, path string) (Series, Series, Series, error)

FindDisk function.

func (*RedisSeriesRepository) FindDiskPaths

func (rsr *RedisSeriesRepository) FindDiskPaths(probe Probe) ([]string, error)

FindDiskPaths function.

func (*RedisSeriesRepository) FindMemory

func (rsr *RedisSeriesRepository) FindMemory(probe Probe, seriesType SeriesType) (Series, Series, Series, error)

FindMemory function.

type Series

type Series []Value

Series type.

type SeriesRepository

type SeriesRepository interface {
	FindCPU(Probe, SeriesType) (Series, Series, Series, error)
	FindMemory(Probe, SeriesType) (Series, Series, Series, error)
	FindDisk(Probe, SeriesType, string) (Series, Series, Series, error)
	FindDiskPaths(Probe) ([]string, error)
	ChunkSize(seriesType SeriesType) int
}

SeriesRepository type.

type SeriesType

type SeriesType string

SeriesType type.

const (
	// Day series.
	Day SeriesType = "day"

	// Week series.
	Week SeriesType = "week"

	// Month series.
	Month SeriesType = "month"
)

type Value

type Value struct {
	X int64   `json:"x"`
	Y float64 `json:"y"`
}

Value type.

Jump to

Keyboard shortcuts

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