context

package
v2.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: Apache-2.0 Imports: 8 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Config       *models.Config
	MessageLog   *logging.Logger
	JsonLog      *stdlog.Logger
	NSQClient    *network.NSQClient
	PharosClient *network.PharosClient
	VolumeClient *network.VolumeClient
	// contains filtered or unexported fields
}

Context sets up the items common to many of the bag processing services (bag_processor, bag_restorer, cleanup, etc.). It also encapsulates some functions common to all of those services.

func NewContext

func NewContext(config *models.Config) (context *Context)

Creates and returns a new Context object. Because some items are absolutely required by this object and the processes that use it, this method will panic if it gets an invalid config param from the command line, or if it cannot set up some essential services, such as logging.

This object is meant to used as a singleton with any of the stand-along processing services (bag_processor, bag_restorer, cleanup, etc.).

func (*Context) Failed

func (context *Context) Failed() int64

Returns the number of work items that failed.

func (*Context) IncrementFailed

func (context *Context) IncrementFailed() int64

Increases the count of unsuccessfully processed items by one.

func (*Context) IncrementSucceeded

func (context *Context) IncrementSucceeded() int64

Increases the count of successfully processed items by one.

func (*Context) LogStats

func (context *Context) LogStats()

Logs info about the number of items that have succeeded and failed.

func (*Context) PathToJsonLog

func (context *Context) PathToJsonLog() string

Returns the path to this process' JSON log file

func (*Context) PathToLogFile

func (context *Context) PathToLogFile() string

Returns the path to this process' log file

func (*Context) Succeeded

func (context *Context) Succeeded() int64

Returns the number of work items that succeeded.

Jump to

Keyboard shortcuts

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