report

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RUNNING = "running"
	CREATED = "created"
	DONE    = "done"
)
View Source
const (
	FILEPERM = 0755
)

Variables

View Source
var ErrTaskReportNotExist = errors.New("Task Report does not exist")

ErrTaskReportNotExist means the report of specific task id does not exist

Functions

This section is empty.

Types

type Checksum

type Checksum struct {
	ID        int    `json:"-"`
	Sha256sum string `json:"sha256sum"`
	Path      Files  `json:"-"`
}

func (*Checksum) Get

func (c *Checksum) Get() error

Get reads sha256sum from file and set to Sha256sum

func (*Checksum) Save

func (c *Checksum) Save(sum string) error

type Files

type Files struct {
	ID                  int
	Dir, Checksum       string
	Status, Result, Log string
}

Files is an aggregation of commando files

func (Files) CreateDir

func (c Files) CreateDir()

CreateDir creates cache dir if not exists

func (*Files) Init

func (c *Files) Init()

Init initiates cache dir and set properties values

type Log

type Log struct {
	ID       int    `json:"-"`
	Content  string `json:"content"`
	Path     Files  `json:"-"`
	Location string `json:"log_path"`
}

func (*Log) Get

func (c *Log) Get() error

func (*Log) Save

func (c *Log) Save(output []byte) error

type Report

type Report struct {
	ID       int      `json:"id"`
	Status   Status   `json:"status"`
	Result   Result   `json:"result"`
	Log      Log      `json:"log"`
	Checksum Checksum `json:"checksum"`
	Path     Files    `json:"-"`
}

Report is composited of Result and Status

func (*Report) Load

func (r *Report) Load() error

Load reads exist report files and get values, returns error if report not exist

func (*Report) New

func (r *Report) New() error

New creates new report without checking if dir existence

type Result

type Result struct {
	ID     int       `json:"-"`
	Result string    `json:"result"`
	Time   time.Time `json:"time"`
	Path   Files     `json:"-"`
}

Result is the object represent the task execution result

func (*Result) Get

func (c *Result) Get() error

Get sets last result and last modification time to Result

func (*Result) SetFail

func (c *Result) SetFail() error

SetFail sets result to fail

func (*Result) SetNotRun

func (c *Result) SetNotRun() error

SetNotRun sets result to not run

func (*Result) SetPass

func (c *Result) SetPass() error

SetPass sets result to pass

type Status

type Status struct {
	ID     int    `json:"-"`
	Status string `json:"status"`
	Path   Files  `json:"-"`
}

func (*Status) Get

func (c *Status) Get() error

func (*Status) SetCreated

func (c *Status) SetCreated() error

func (*Status) SetDone

func (c *Status) SetDone() error

func (*Status) SetRunning

func (c *Status) SetRunning() error

Jump to

Keyboard shortcuts

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