daemon

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSV

func CSV(ctx context.Context, url string) (*http.Response, error)

CSV makes a request for a CSV file content

func JSON

func JSON(ctx context.Context, url string) (*http.Response, error)

JSON makes a request for JSON data

func NewLogger

func NewLogger(name string) *report.Logger

NewLogger creates a logger for the supervisor or other actions

The logger expects the following env variables:

HONEYCOMB_API_KEY (no default, blank to skip honeycomb integration)
NODE_NAME (no default, name of k8s node for logging)
POD_NAME (no default, name of k8s pod for logging)

func ParseFloat

func ParseFloat(raw json.RawMessage) (float32, error)

ParseFloat defensively parses a raw json field into a float

func ParseString

func ParseString(raw json.RawMessage) (string, error)

ParseString defensively parses a raw json field into a string

Types

type Supervisor

type Supervisor struct {
	*report.Logger
	// contains filtered or unexported fields
}

Supervisor is a supervised instance of a running daemon

func New

func New(name string) *Supervisor

New creates a new daemon

func (*Supervisor) Close

func (d *Supervisor) Close()

Close invokes a deamon shutdown

func (*Supervisor) CloseAfter

func (d *Supervisor) CloseAfter(duration time.Duration)

CloseAfter closes the daemon after the specified delay

func (*Supervisor) CloseWait

func (d *Supervisor) CloseWait()

CloseWait invokes a deamon shutdown and blocks until complete

func (*Supervisor) Run

func (d *Supervisor) Run(ctx context.Context, fn func(ctx context.Context, d *Supervisor) error)

Run executes a background function

The daemon will shutdown if the function returns an unhandled error.

func (*Supervisor) Wait

func (d *Supervisor) Wait()

Wait blocks until the daemon has shutdown

Jump to

Keyboard shortcuts

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