runtime

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2016 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package runtime contains the generic functionality that an engine and plugins use.

Index

Constants

This section is empty.

Variables

View Source
var ErrConflictingSchemas = errors.New("Two schema entries are conflicting!")

ErrConflictingSchemas is returned if two schema entries are conflicting.

Functions

func NewTaskContext

func NewTaskContext(tempLogFile string) (*TaskContext, *TaskContextController, error)

NewTaskContext creates a TaskContext and associated TaskContextController

Types

type CompositeSchema

type CompositeSchema interface {
	Parse(data map[string]json.RawMessage) (interface{}, error)
	// contains filtered or unexported methods
}

CompositeSchema hides one or more composed JSON schemas.

func MergeCompositeSchemas

func MergeCompositeSchemas(schemas ...CompositeSchema) (CompositeSchema, error)

MergeCompositeSchemas will merge two or more CompositeSchema

When CompositeSchema.Parse is called it will return an array of the results from the schemas that were merged. Hence, the order in which the schemas is given is important and will be preserved.

This function may return ErrConflictingSchemas, if two of the schemas merged have conflicting definitions.

func NewCompositeSchema

func NewCompositeSchema(
	property string,
	schema string,
	required bool,
	makeTarget func() interface{},
) (CompositeSchema, error)

NewCompositeSchema creates a CompositeSchema from the description of a single property and a function to produce unmarshalling targets with.

Schema will only validate the 'property' against the JSON schema passed as 'schema'. If the 'required' is true the property must be present.

When parsing the makeTarget will be used as factory to create objects which the payload will unmarshalled to.

func NewEmptyCompositeSchema

func NewEmptyCompositeSchema() CompositeSchema

NewEmptyCompositeSchema returns a CompositeSchema schema that is empty. The resulting value from Parse is nil, and the schema does no validation.

type Environment

type Environment struct {
	GarbageCollector *gc.GarbageCollector
}

type TaskContext

type TaskContext struct {
	TaskInfo
	// contains filtered or unexported fields
}

The TaskContext exposes generic properties and functionality related to a task that is currently being executed.

This context is used to ensure that every component both engines and plugins that operates on a task have access to some common information about the task. This includes log drains, per-task credentials, generic task properties, and abortion notifications.

func (*TaskContext) Log

func (c *TaskContext) Log(a ...interface{})

Log writes a log message from the worker

These log messages will be prefixed "[taskcluster]" so it's easy to see to that they are worker logs.

func (*TaskContext) LogDrain

func (c *TaskContext) LogDrain() io.Writer

LogDrain returns a drain to which log message can be written.

Users should note that multiple writers are writing to this drain concurrently, and it is recommend that writers write in chunks of one line.

func (*TaskContext) NewLogReader

func (c *TaskContext) NewLogReader() (io.ReadCloser, error)

NewLogReader returns a ReadCloser that reads the log from the start as the log is written.

Calls to Read() on the resulting ReadCloser are blocking. They will return when data is written or EOF is reached.

Consumers should ensure the ReadCloser is closed before discarding it.

type TaskContextController

type TaskContextController struct {
	*TaskContext
}

TaskContextController exposes logic for controlling the TaskContext.

Spliting this out from TaskContext ensures that engines and plugins doesn't accidentally Dispose() the TaskContext.

func (*TaskContextController) CloseLog

func (c *TaskContextController) CloseLog() error

CloseLog will close the log so no more messages can be written.

func (*TaskContextController) Dispose

func (c *TaskContextController) Dispose() error

Dispose will clean-up all resources held by the TaskContext

type TaskInfo

type TaskInfo struct {
}

The TaskInfo struct exposes generic properties from a task definition.

Directories

Path Synopsis
Package gc contains the GarbageCollector which allows cacheable resources to register themselves for disposal when we run low on resources.
Package gc contains the GarbageCollector which allows cacheable resources to register themselves for disposal when we run low on resources.

Jump to

Keyboard shortcuts

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