db

package
v0.0.0-...-03d6fc4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TEST_DATA_FILENAME     = "task-driver-messages2.json"
	TEST_DATA_STORAGE_DIR  = "task-driver-testdata"
	TEST_DATA_STORAGE_PATH = TEST_DATA_STORAGE_DIR + "/" + TEST_DATA_FILENAME
)

Variables

This section is empty.

Functions

func TestDB

func TestDB(t testutils.TestingT, d DB)

Test basic DB functionality.

func TestMessageOrdering

func TestMessageOrdering(t testutils.TestingT, d DB)

Verify that messages can arrive in any order with the same result.

Types

type DB

type DB interface {
	// GetTaskDriver returns the TaskDriver instance with the given ID. If
	// the Task Driver does not exist, returns nil with no error.
	GetTaskDriver(string) (*TaskDriverRun, error)

	// UpdateTaskDriver updates the Task Driver with the given ID from the
	// given Message. If no TaskDriver with the given ID exists, the DB will
	// create and insert one. The DB implementation is responsible for
	// handling thread safety, as messages may arrive simultaneously.
	UpdateTaskDriver(string, *td.Message) error

	// Close closes the DB.
	Close() error
}

DB is an interface used for storing information about Task Drivers.

type Step

type Step struct {
	Properties *td.StepProperties `json:"properties"`
	Data       []*StepData        `json:"data"`
	Started    time.Time          `json:"started"`
	Finished   time.Time          `json:"finished"`
	Result     td.StepResult      `json:"result"`
	Errors     []string           `json:"errors"`
}

Step represents one step in a single run of a Task Driver.

func (*Step) Copy

func (s *Step) Copy() *Step

Copy returns a deep copy of the Step.

type StepData

type StepData struct {
	Type     td.DataType `json:"type"`
	Data     interface{} `json:"data"`
	MsgIndex int         `json:"msgIndex"`
}

StepData represents data attached to a step.

type StepDataSlice

type StepDataSlice []*StepData

func (StepDataSlice) Len

func (s StepDataSlice) Len() int

func (StepDataSlice) Less

func (s StepDataSlice) Less(i, j int) bool

func (StepDataSlice) Swap

func (s StepDataSlice) Swap(i, j int)

type TaskDriverRun

type TaskDriverRun struct {
	TaskId     string
	Properties *td.RunProperties
	Steps      map[string]*Step
}

TaskDriverRun represents a single run of a Task Driver.

func (*TaskDriverRun) Copy

func (t *TaskDriverRun) Copy() *TaskDriverRun

Copy returns a deep copy of the TaskDriverRun.

func (*TaskDriverRun) UpdateFromMessage

func (t *TaskDriverRun) UpdateFromMessage(m *td.Message) error

Update a TaskDriverRun from the given Message. This is NOT thread-safe, so DB implementations will need to serialize calls to UpdateFromMessage for a given TaskDriverRun.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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