domain

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskTypeRandom  = "random"
	TaskTypeFailing = "failing"
	TaskTypeParser  = "parser"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateTaskArgs

type CreateTaskArgs struct {
	ID          int             `json:"id"`
	Type        string          `json:"type"`
	Code        string          `json:"code"`
	Title       string          `json:"title"`
	Description string          `json:"description"`
	Active      bool            `json:"active"`
	Display     bool            `json:"display"`
	Schedule    string          `json:"schedule"`
	Category    string          `json:"category"`
	Tags        []string        `json:"tags"`
	Args        json.RawMessage `json:"args"`
}

type Dimension

type Dimension struct {
	ID       int
	MetricID int
	Title    string // e.g. city
	Value    string // e.g. Moscow
	Meta     map[string]interface{}
}

type Item

type Item struct {
	ID             int
	TaskInstanceID int
	Metric         *Metric
	Value          float64
	Dimensions     []*Dimension
	Timestamp      time.Time
	Meta           map[string]interface{}
}

type Metric

type Metric struct {
	ID          int
	TaskID      int
	Title       string                 `json:"title"`
	Description string                 `json:"description"`
	Meta        map[string]interface{} `json:"meta"`
}

type SystemSymmary

type SystemSymmary struct {
	ID                      int
	Tasks                   int
	ActiveTasks             int
	RunningTasks            int
	CompletedTasks          int
	FailedTasks             int
	Metrics                 int
	CollectedItems          int
	AvgItemsPerTask         float64
	AvgItemsPerTaskInstance float64
	AvgItemsPerMetric       float64
	CreateTime              time.Time
}

type Task

type Task struct {
	ID          int
	Type        string
	Code        string
	Title       string
	Description string
	Active      bool
	Display     bool
	Schedule    string
	Category    *TaskCategory
	Metrics     []*Metric
	Tags        []*TaskTag
	Args        TaskArgs                                                           `json:"-"`
	ResolveFn   func(context.Context, *Task, *TaskInstance) (*TaskInstance, error) `json:"-"`
}

func (*Task) GetMetric

func (t *Task) GetMetric(title string) (*Metric, bool)

func (*Task) JSONString

func (t *Task) JSONString() string

type TaskArgs

type TaskArgs interface {
	Get(string) (interface{}, bool)
	GetString(string) (string, bool)
	GetFloat(string) (float64, bool)
	GetInt(string) (int, bool)
	ToMap() map[string]interface{}
	ToJSON() json.RawMessage
}

type TaskCategory

type TaskCategory struct {
	ID          int
	Title       string
	Description string
	Display     bool
	Meta        map[string]interface{}
}

type TaskInstance

type TaskInstance struct {
	ID        int
	TaskID    int
	StartTime time.Time
	EndTime   time.Time
	Success   bool
	Running   bool
	Error     error
	Attempt   int
	Items     []*Item
	Meta      map[string]interface{}
}

func InitTaskInstance

func InitTaskInstance(taskID int, attempt int) *TaskInstance

func (*TaskInstance) WithError

func (ti *TaskInstance) WithError(err error, items []*Item) *TaskInstance

func (*TaskInstance) WithSuccess

func (ti *TaskInstance) WithSuccess(items []*Item) *TaskInstance

type TaskTag

type TaskTag struct {
	ID          int
	Title       string
	Description string
	Display     bool
	Meta        map[string]interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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