history

package
v0.0.0-...-a12d374 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToLogWriter

func ToLogWriter(service *Service) execution.LogWriter

func ToStatusWriter

func ToStatusWriter(service *Service) execution.StateWriter

Types

type DbContext

type DbContext interface {
	GetHistoryRepository(projectID string) (Repository, error)
}

type LogWriterFn

type LogWriterFn func(job execution.Job, data []byte) (n int, err error)

func (LogWriterFn) Write

func (fn LogWriterFn) Write(job execution.Job, data []byte) (n int, err error)

type QueryResult

type QueryResult struct {
	dal.QueryResult
	Data []RecordEntity
}

type Record

type Record struct {
	JobID     string                 `json:"job_id"`
	ScriptID  string                 `json:"script_id"`
	ScriptRev string                 `json:"script_rev"`
	Params    map[string]interface{} `json:"params"`
	Status    execution.Status       `json:"status"`
	CausedBy  execution.Cause        `json:"cause"`
	StartedAt time.Time              `json:"started_at"`
	EndedAt   time.Time              `json:"ended_at"`
	Logs      []string               `json:"logs"`
	Error     error                  `json:"error"`
}

Represents a job history record It gets updated during the job life cycle

type RecordEntity

type RecordEntity struct {
	dal.Entity
	Record
}

type Repository

type Repository interface {
	Create(ctx context.Context, entry Record) (dal.Entity, error)

	Update(ctx context.Context, entry Record) (dal.Entity, error)

	Get(ctx context.Context, id string) (RecordEntity, error)

	Find(ctx context.Context, q dal.Query) (QueryResult, error)
}

type Service

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

func NewService

func NewService(db DbContext) (*Service, error)

func (*Service) Create

func (service *Service) Create(ctx context.Context, job execution.Job) error

func (*Service) Find

func (service *Service) Find(ctx context.Context, projectID string, q dal.Query) (QueryResult, error)

func (*Service) Get

func (service *Service) Get(ctx context.Context, projectID, jobID string) (RecordEntity, error)

func (*Service) Log

func (service *Service) Log(ctx context.Context, projectID, jobID string, data []byte) (dal.Entity, error)

func (*Service) Update

func (service *Service) Update(ctx context.Context, state execution.State) (dal.Entity, error)

type StatusWriterFn

type StatusWriterFn func(state execution.State) error

func (StatusWriterFn) Write

func (fn StatusWriterFn) Write(status execution.State) error

type UpdateRecord

type UpdateRecord struct {
	Record
	ID string `json:"id"`
}

Jump to

Keyboard shortcuts

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