journey

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: MIT Imports: 14 Imported by: 1

Documentation

Overview

Package journey defines a context type, which carries information about a specific inbound request. It is created when it hits the first service and it is propagated across all services.

It has been named journey instead of request, because a journey can result of multiple sub-requests. And also because it sounds nice, isn't it?

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ctx

type Ctx interface {
	ctx.Ctx

	UUID() string
	ShortID() string
	AppConfig() *config.Config
	BG(f func(c Ctx)) error
	BranchOff(t Type) Ctx
	Cancel()
	End()

	// Net context functions
	Deadline() (deadline time.Time, ok bool)
	Done() <-chan struct{}
	Err() error
	Value(key interface{}) interface{}
}

Ctx is the journey context interface

func New

func New(ctx app.Ctx) Ctx

New creates a new context and returns it

type Stepper

type Stepper struct {
	Steps []uint32
	I     int
	// contains filtered or unexported fields
}

Stepper is the atomic counter for context log lines

func NewStepper

func NewStepper() *Stepper

NewStepper builds a new main stepper

func (*Stepper) BranchOff

func (s *Stepper) BranchOff() *Stepper

BranchOff returns a new "child" stepper

func (*Stepper) Inc

func (s *Stepper) Inc() uint

Inc increments the current counter

func (*Stepper) String

func (s *Stepper) String() string

String returns a string representation of the current state

type Type

type Type int

Type represents a context type (Foreground or Background)

const (
	Child Type = iota
	Root
)

Jump to

Keyboard shortcuts

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