db

package
v0.0.0-...-be64df0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskStatusActive    = "active"
	TaskStatusCompleted = "completed"
	TaskStatusError     = "error"
	TaskStatusAborted   = "aborted"
	TaskStatusDeleted   = "deleted"

	InstanceStatusActive = "active"
	InstanceStatusDone   = "done"
	InstanceStatusError  = "error"

	FormatFHIR = "FHIR"
	FormatCCDA = "CCDA"
	FormatHTML = "HTML"
	FormatText = "text"
	FormatCSV  = "CSV"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataAccessLayer

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

DataAccessLayer exposes all methods needed to access saved state in MongoDB.

func NewDataAccessLayer

func NewDataAccessLayer(session *mgo.Session, dbname string) *DataAccessLayer

NewDataAccessLayer creates a new Stork data access layer

func (*DataAccessLayer) CreateTask

func (s *DataAccessLayer) CreateTask(task *Task) (string, error)

CreateTask adds a new task to the database

func (*DataAccessLayer) DeleteTask

func (s *DataAccessLayer) DeleteTask(taskID string) error

DeleteTask marks a task in the database as "deleted"

func (*DataAccessLayer) GetTask

func (s *DataAccessLayer) GetTask(taskID string) (*Task, error)

GetTask retrieves a Task from the database, by ID

func (*DataAccessLayer) GetTasks

func (s *DataAccessLayer) GetTasks() (*TaskList, error)

GetTasks retrieves all tasks from the database, excluding those that were deleted.

func (*DataAccessLayer) UpdateTask

func (s *DataAccessLayer) UpdateTask(task *Task) (*Task, error)

UpdateTask updates a task in the database

type Task

type Task struct {
	ID          string     `bson:"_id" json:"id"`
	Status      string     `bson:"status" json:"status"`
	StartTime   *time.Time `bson:"startTime" json:"startTime"`
	EndTime     *time.Time `bson:"endTime" json:"endTime"`
	InstanceIDs []string   `bson:"instanceIds" json:"instanceIds"`
	BucketName  string     `bson:"bucketName" json:"bucketName"`
	User        string     `bson:"user" json:"user"`
	Formats     []string   `bson:"formats" json:"formats"`
}

Task is a single Stork task

func (*Task) ElapsedTime

func (t *Task) ElapsedTime() time.Duration

ElapsedTime returns the total runtime for this tasks. For active tasks, this changes constantly until the task is done or stopped.

func (*Task) End

func (t *Task) End()

End records the current time as the end time

func (*Task) Start

func (t *Task) Start()

Start records the current time as the start time

type TaskList

type TaskList struct {
	Tasks []Task `json:"tasks"`
}

TaskList is a list of Stork Tasks

Jump to

Keyboard shortcuts

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