stage

package
v0.0.0-...-9678add Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2017 License: BSD-3-Clause Imports: 4 Imported by: 1

Documentation

Overview

Package stage stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.

Index

Constants

View Source
const (
	Failure state = "failure"
	Replay  state = "replay"
	Success state = "success"
	Trial   state = "trial"
)

Variables

This section is empty.

Functions

func Disable

func Disable(ctx context.Context) context.Context

Disable removes the context value being stored using valueKey and backs it up using restoreKey.

func IsDisabled

func IsDisabled(ctx context.Context) bool

IsDisabled checks whether the given context has the context value removed and backed up.

func IsInvalidExecution

func IsInvalidExecution(err error) bool

IsInvalidExecution asserts invalidExecutionError.

func NewContext

func NewContext(ctx context.Context, val Value) context.Context

NewContext returns a new github.com/the-anna-project/context.Context that carries the context value val.

func NewContextFromContexts

func NewContextFromContexts(ctx context.Context, ctxs []context.Context) (context.Context, error)

NewContextFromContexts sets the context value from the given list of contexts to the given single context. Therefore all context values transported by all contexts of the given list of contexts have to be equal.

func Restore

func Restore(ctx context.Context) context.Context

Restore sets the context value using the value being backed up by a previous call to Disable.

Types

type Value

type Value struct {
	// State expresses the state of the current stage.
	State state `json:"state"`
}

Value is the context value being managed by this package.

func FromContext

func FromContext(ctx context.Context) (Value, bool)

FromContext returns the context value stored in ctx, if any.

func (Value) Equals

func (v Value) Equals(other Value) bool

Equals checks whether the properties of the current value equals the properties of the given value.

func (Value) Failure

func (v Value) Failure() bool

Failure checks whether the state of the current stage is Failure.

func (Value) Replay

func (v Value) Replay() bool

Replay checks whether the state of the current stage is Replay.

func (Value) Success

func (v Value) Success() bool

Success checks whether the state of the current stage is Success.

func (Value) Trial

func (v Value) Trial() bool

Trial checks whether the state of the current stage is Trial.

Jump to

Keyboard shortcuts

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