communication

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package communication contains necessary logic for passing messages, returning errors and stop signals. The Engine will issue a ReadJob with a context and sends it to the readers. The NewReadJob function injects a unique ID into the context and returns it. All readers/recorders should use this JobID for returning errors and logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReadJob

func NewReadJob(ctx context.Context) context.Context

NewReadJob constructs a ReadJob with the provided context

Types

type ErrorMessage

type ErrorMessage struct {
	// The ID comes from the issued job.
	ID JobID
	// Name is the name of the instance, which is returned by its Name() method
	Name string
	Err  error
}

An ErrorMessage is sent when an error occurs.

func (*ErrorMessage) Error

func (e *ErrorMessage) Error() string

type JobID

type JobID uuid.UUID

JobID is a unique ID. Only the Engine issues this ID and you should pass it along as you receive.

func JobValue

func JobValue(ctx context.Context) JobID

JobValue returns the recorded value in the context

func NewJobID

func NewJobID() JobID

NewJobID returns a new unique ID

func (JobID) String

func (j JobID) String() string

type ReadJob

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

ReadJob is a package we send to readers to do their work.

func (*ReadJob) Context

func (r *ReadJob) Context() context.Context

Context returns the context of the message

func (*ReadJob) ID

func (r *ReadJob) ID() JobID

ID returns the id of the message

func (*ReadJob) String

func (r *ReadJob) String() string

type StopChannel added in v0.4.0

type StopChannel chan chan struct{}

StopChannel is used to signal each component when to stop. They should return a signal back when they have finished their work.

Jump to

Keyboard shortcuts

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