communication

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package communication contains necessary logic for passing messages and returning errors. 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 occures.

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 recieve.

func JobValue

func JobValue(ctx context.Context) JobID

JobValue returns the value recorder 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

Jump to

Keyboard shortcuts

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