techmetrics

package
v0.0.0-...-9b5cd94 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskStatusNone = iota
	TaskStatusRunning
	TaskStatusSucceeded
	TaskStatusFailed
	TaskStatusDisabled
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	StartExport(c *gin.Context)
	GetExport(c *gin.Context)
	DownloadExport(c *gin.Context)
}

func NewApi

func NewApi(
	taskExecutor TaskExecutor,
	timezoneConfigProvider config.TimezoneConfigProvider,
) API

type ExportResponse

type ExportResponse struct {
	// Possible values.
	//   * `0` - None
	//   * `1` - Running
	//   * `2` - Succeeded
	//   * `3` - Failed
	//   * `4` - Disabled
	Status   int               `json:"status"`
	Created  *datetime.CpsTime `json:"created,omitempty" swaggertype:"integer"`
	Duration *int              `json:"duration,omitempty"`
}

type Task

type Task struct {
	ID        int
	Status    int
	Filepath  string
	Created   time.Time
	LastPing  time.Time
	Started   *time.Time
	Completed *time.Time
}

type TaskExecutor

type TaskExecutor interface {
	Run(ctx context.Context)
	// StartExecute creates new export task.
	StartExecute(ctx context.Context) (Task, error)
	// GetStatus returns export task status.
	GetStatus(ctx context.Context) (Task, error)
}

TaskExecutor is used to implement export task executor.

func NewTaskExecutor

func NewTaskExecutor(
	configProvider config.TechMetricsConfigProvider,
	logger zerolog.Logger,
) TaskExecutor

Jump to

Keyboard shortcuts

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