metathings_evaluatord_storage

package
v1.3.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INFLUXDB2_CONST_TASK_MASUREMENT = "evaluatord.task"
	INFLUXDB2_CONST_TASK            = "#task"
	INFLUXDB2_CONST_SOURCE          = "#source"
	INFLUXDB2_CONST_SOURCE_TYPE     = "#source_type"
	INFLUXDB2_CONST_STATE           = "$state"
)

Variables

View Source
var (
	ErrUnknownTaskStorageDriver  = errors.New("unknown task storage driver")
	ErrUnknownTimerStorageDriver = errors.New("unknown timer storage driver")
	ErrTaskNotFound              = errors.New("task not found")
)

Functions

func SetRangeStartOption added in v1.1.28

func SetRangeStartOption(start interface{}) func(objx.Map)

func SetRangeStopOption added in v1.1.28

func SetRangeStopOption(stop interface{}) func(objx.Map)

Types

type DefaultTimerStorage added in v1.1.28

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

func (*DefaultTimerStorage) AddConfigsToTimer added in v1.1.28

func (s *DefaultTimerStorage) AddConfigsToTimer(ctx context.Context, timer_id string, config_ids []string) error

func (*DefaultTimerStorage) CreateTimer added in v1.1.28

func (s *DefaultTimerStorage) CreateTimer(ctx context.Context, t *Timer) (*Timer, error)

func (*DefaultTimerStorage) DeleteTimer added in v1.1.28

func (s *DefaultTimerStorage) DeleteTimer(ctx context.Context, id string) error

func (*DefaultTimerStorage) ExistTimer added in v1.1.28

func (s *DefaultTimerStorage) ExistTimer(ctx context.Context, t *Timer) (bool, error)

func (*DefaultTimerStorage) GetDBConn added in v1.1.28

func (s *DefaultTimerStorage) GetDBConn(ctx context.Context) *gorm.DB

func (*DefaultTimerStorage) GetRootDBConn added in v1.1.28

func (s *DefaultTimerStorage) GetRootDBConn() *gorm.DB

func (*DefaultTimerStorage) GetTimer added in v1.1.28

func (s *DefaultTimerStorage) GetTimer(ctx context.Context, id string) (*Timer, error)

func (*DefaultTimerStorage) ListTimers added in v1.1.28

func (s *DefaultTimerStorage) ListTimers(ctx context.Context, t *Timer) ([]*Timer, error)

func (*DefaultTimerStorage) PatchTimer added in v1.1.28

func (s *DefaultTimerStorage) PatchTimer(ctx context.Context, id string, t *Timer) (*Timer, error)

func (*DefaultTimerStorage) RemoveConfigsFromTimer added in v1.1.28

func (s *DefaultTimerStorage) RemoveConfigsFromTimer(ctx context.Context, timer_id string, config_ids []string) error

type DefaultTimerStorageOption added in v1.1.28

type DefaultTimerStorageOption struct {
	IsTraced bool
	Driver   string
	Uri      string
}

type Evaluator

type Evaluator struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	Alias       *string `gorm:"column:alias"`
	Description *string `gorm:"column:description"`
	Config      *string `gorm:"column:config"`

	Sources  []*Resource `gorm:"-"`
	Operator *Operator   `gorm:"-"`
}

type EvaluatorSourceMapping

type EvaluatorSourceMapping struct {
	CreatedAt time.Time

	EvaluatorId *string `gorm:"column:evaluator_id"`
	SourceId    *string `gorm:"column:source_id"`
	SourceType  *string `gorm:"column:source_type"`
}

type Influxdb2TaskStorage added in v1.1.28

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

func (*Influxdb2TaskStorage) GetTask added in v1.1.28

func (s *Influxdb2TaskStorage) GetTask(ctx context.Context, id string) (*Task, error)

func (*Influxdb2TaskStorage) ListTasksBySource added in v1.1.28

func (s *Influxdb2TaskStorage) ListTasksBySource(ctx context.Context, src *Resource, opts ...ListTasksBySourceOption) ([]*Task, error)

func (*Influxdb2TaskStorage) PatchTask added in v1.1.28

func (s *Influxdb2TaskStorage) PatchTask(ctx context.Context, tsk *Task, ts *TaskState) error

type Influxdb2TaskStorageOption added in v1.1.28

type Influxdb2TaskStorageOption struct {
	Address string
	Token   string
	Org     string
	Bucket  string
}

type ListTasksBySourceOption added in v1.1.28

type ListTasksBySourceOption func(objx.Map)

type LuaDescriptor

type LuaDescriptor struct {
	CreatedAt time.Time

	OperatorId *string `gorm:"column:operator_id"`

	Code *string `gorm:"column:code"`
}

type Operator

type Operator struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	EvaluatorId *string `gorm:"column:evaluator_id"`
	Alias       *string `gorm:"column:alias"`
	Description *string `gorm:"column:description"`

	Driver *string `gorm:"column:driver"`

	LuaDescriptor *LuaDescriptor `gorm:"-"`
}

type Resource

type Resource struct {
	Id   *string
	Type *string
}

type Storage

type Storage interface {
	CreateEvaluator(context.Context, *Evaluator) (*Evaluator, error)
	DeleteEvaluator(ctx context.Context, id string) error
	PatchEvaluator(ctx context.Context, id string, evaluator *Evaluator) (*Evaluator, error)
	GetEvaluator(ctx context.Context, id string) (*Evaluator, error)
	ListEvaluators(context.Context, *Evaluator) ([]*Evaluator, error)
	ListEvaluatorsBySource(context.Context, *Resource) ([]*Evaluator, error)
	AddSourcesToEvaluator(ctx context.Context, evaluator_id string, sources []*Resource) error
	RemoveSourcesFromEvaluator(ctx context.Context, evaluator_id string, sources []*Resource) error
	ExistEvaluator(context.Context, *Evaluator) (bool, error)
	ExistOperator(context.Context, *Operator) (bool, error)
}

func NewStorage

func NewStorage(driver, uri string, args ...interface{}) (Storage, error)

func NewStorageImpl

func NewStorageImpl(driver, uri string, args ...interface{}) (Storage, error)

type StorageImpl

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

func (*StorageImpl) AddSourcesToEvaluator

func (stor *StorageImpl) AddSourcesToEvaluator(ctx context.Context, evaluator_id string, sources []*Resource) error

func (*StorageImpl) CreateEvaluator

func (stor *StorageImpl) CreateEvaluator(ctx context.Context, e *Evaluator) (*Evaluator, error)

func (*StorageImpl) DeleteEvaluator

func (stor *StorageImpl) DeleteEvaluator(ctx context.Context, id string) error

func (*StorageImpl) ExistEvaluator

func (stor *StorageImpl) ExistEvaluator(ctx context.Context, e *Evaluator) (bool, error)

func (*StorageImpl) ExistOperator

func (stor *StorageImpl) ExistOperator(ctx context.Context, o *Operator) (bool, error)

func (*StorageImpl) GetDBConn

func (stor *StorageImpl) GetDBConn(ctx context.Context) *gorm.DB

func (*StorageImpl) GetEvaluator

func (stor *StorageImpl) GetEvaluator(ctx context.Context, id string) (*Evaluator, error)

func (*StorageImpl) GetRootDBConn

func (stor *StorageImpl) GetRootDBConn() *gorm.DB

func (*StorageImpl) ListEvaluators

func (stor *StorageImpl) ListEvaluators(ctx context.Context, e *Evaluator) ([]*Evaluator, error)

func (*StorageImpl) ListEvaluatorsBySource

func (stor *StorageImpl) ListEvaluatorsBySource(ctx context.Context, src *Resource) ([]*Evaluator, error)

func (*StorageImpl) PatchEvaluator

func (stor *StorageImpl) PatchEvaluator(ctx context.Context, id string, e *Evaluator) (*Evaluator, error)

func (*StorageImpl) RemoveSourcesFromEvaluator

func (stor *StorageImpl) RemoveSourcesFromEvaluator(ctx context.Context, evaluator_id string, sources []*Resource) error

type StorageImplOption

type StorageImplOption struct {
	IsTraced bool
}

type Task added in v1.1.28

type Task struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	CurrentState *TaskState
	Source       *Resource

	States []*TaskState
}

type TaskState added in v1.1.28

type TaskState struct {
	At    *time.Time
	State *string
	Tags  map[string]interface{}
}

type TaskStorage added in v1.1.28

type TaskStorage interface {
	ListTasksBySource(ctx context.Context, src *Resource, opts ...ListTasksBySourceOption) ([]*Task, error)
	GetTask(context.Context, string) (*Task, error)
	PatchTask(context.Context, *Task, *TaskState) error
}

func NewInfluxdb2TaskStorage added in v1.1.28

func NewInfluxdb2TaskStorage(args ...interface{}) (TaskStorage, error)

func NewTaskStorage added in v1.1.28

func NewTaskStorage(driver string, args ...interface{}) (TaskStorage, error)

type TaskStorageFactory added in v1.1.28

type TaskStorageFactory func(...interface{}) (TaskStorage, error)

type Timer added in v1.1.28

type Timer struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	Alias       *string  `gorm:"column:alias"`
	Description *string  `gorm:"column:description"`
	Schedule    *string  `gorm:"column:schedule"`
	Timezone    *string  `gorm:"column:timezone"`
	Enabled     *bool    `gorm:"column:enabled"`
	Configs     []string `gorm:"-"`
}

type TimerConfigMapping added in v1.1.28

type TimerConfigMapping struct {
	CreatedAt time.Time

	TimerId  *string `gorm:"column:timer_id"`
	ConfigId *string `gorm:"column:config_id"`
}

type TimerStorage added in v1.1.28

type TimerStorage interface {
	CreateTimer(context.Context, *Timer) (*Timer, error)
	DeleteTimer(context.Context, string) error
	PatchTimer(context.Context, string, *Timer) (*Timer, error)
	GetTimer(context.Context, string) (*Timer, error)
	ListTimers(context.Context, *Timer) ([]*Timer, error)
	AddConfigsToTimer(ctx context.Context, timer_id string, config_ids []string) error
	RemoveConfigsFromTimer(ctx context.Context, timer_id string, config_ids []string) error
	ExistTimer(context.Context, *Timer) (bool, error)
}

func NewDefaultTimerStorage added in v1.1.28

func NewDefaultTimerStorage(args ...interface{}) (TimerStorage, error)

func NewTimerStorage added in v1.1.28

func NewTimerStorage(driver string, args ...interface{}) (TimerStorage, error)

func NewTracedTimerStorage added in v1.1.28

type TimerStorageFactory added in v1.1.28

type TimerStorageFactory func(...interface{}) (TimerStorage, error)

type TracedStorage

type TracedStorage struct {
	*opentracing_storage_helper.BaseTracedStorage
	Storage
}

func (*TracedStorage) AddSourcesToEvaluator

func (s *TracedStorage) AddSourcesToEvaluator(ctx context.Context, evaluator_id string, sources []*Resource) error

func (*TracedStorage) CreateEvaluator

func (s *TracedStorage) CreateEvaluator(ctx context.Context, e *Evaluator) (*Evaluator, error)

func (*TracedStorage) DeleteEvaluator

func (s *TracedStorage) DeleteEvaluator(ctx context.Context, id string) error

func (*TracedStorage) ExistEvaluator

func (s *TracedStorage) ExistEvaluator(ctx context.Context, e *Evaluator) (bool, error)

func (*TracedStorage) ExistOperator

func (s *TracedStorage) ExistOperator(ctx context.Context, o *Operator) (bool, error)

func (*TracedStorage) GetEvaluator

func (s *TracedStorage) GetEvaluator(ctx context.Context, id string) (*Evaluator, error)

func (*TracedStorage) ListEvaluators

func (s *TracedStorage) ListEvaluators(ctx context.Context, e *Evaluator) ([]*Evaluator, error)

func (*TracedStorage) PatchEvaluator

func (s *TracedStorage) PatchEvaluator(ctx context.Context, id string, e *Evaluator) (*Evaluator, error)

func (*TracedStorage) RemoveSourcesFromEvaluator

func (s *TracedStorage) RemoveSourcesFromEvaluator(ctx context.Context, evaluator_id string, sources []*Resource) error

type TracedTimerStorage added in v1.1.28

type TracedTimerStorage struct {
	*opentracing_storage_helper.BaseTracedStorage
	TimerStorage
}

func (*TracedTimerStorage) AddConfigsToTimer added in v1.1.28

func (s *TracedTimerStorage) AddConfigsToTimer(ctx context.Context, timer_id string, config_ids []string) error

func (*TracedTimerStorage) CreateTimer added in v1.1.28

func (s *TracedTimerStorage) CreateTimer(ctx context.Context, t *Timer) (*Timer, error)

func (*TracedTimerStorage) DeleteTimer added in v1.1.28

func (s *TracedTimerStorage) DeleteTimer(ctx context.Context, id string) error

func (*TracedTimerStorage) ExistTimer added in v1.1.28

func (s *TracedTimerStorage) ExistTimer(ctx context.Context, t *Timer) (bool, error)

func (*TracedTimerStorage) GetTimer added in v1.1.28

func (s *TracedTimerStorage) GetTimer(ctx context.Context, id string) (*Timer, error)

func (*TracedTimerStorage) ListTimers added in v1.1.28

func (s *TracedTimerStorage) ListTimers(ctx context.Context, t *Timer) ([]*Timer, error)

func (*TracedTimerStorage) PatchTimer added in v1.1.28

func (s *TracedTimerStorage) PatchTimer(ctx context.Context, id string, t *Timer) (*Timer, error)

func (*TracedTimerStorage) RemoveConfigsFromTimer added in v1.1.28

func (s *TracedTimerStorage) RemoveConfigsFromTimer(ctx context.Context, timer_id string, config_ids []string) error

Jump to

Keyboard shortcuts

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