context

package module
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: 6 Imported by: 21

README

maturity build status code coverage GoDoc

context

The context package implements context primitives to distribute information across event queues.

Documentation

Overview

Package context implements golang.org/x/net/context.Context and provides marshallable context primitives to distribute information across event queues.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

Types

type Config

type Config struct {
	// Settings.
	Context nativecontext.Context
}

Config represents the configuration used to create a new context.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig provides a default configuration to create a new context by best effort.

type Context

type Context interface {
	Cancel()
	Clone() (Context, error)
	// Create stores the given key/value pair within the current context. In case
	// a key is provided that already exists, this key's value will be overwritten
	// with the given one.
	Create(key string, value interface{})
	Deadline() (time.Time, bool)
	Delete(key string)
	Done() <-chan struct{}
	Err() error
	json.Marshaler
	json.Unmarshaler
	Search(key string) interface{}
}

Context is a marshallable container used to transport information across processes. That is why the interface orients on the native golang context, but does not fully replicate it. Reason for this is that a context maps keys to values. JSON requires keys of maps to be strings. The native golang context defines keys as interface{} to leverage go's type system for unique keys. To prevent key collisions from interfering packages, each package should prefix its key with its own package path like it would be imported. This would be a good context package key, even though it is really long.

github.com/the-anna-project/context/current/behaviour

This package helps to automatically use the package base path.

github.com/the-anna-project/gopkg

func New

func New(config Config) (Context, error)

New creates a new configured context object.

Directories

Path Synopsis
current
behaviour
Package behaviour stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
Package behaviour stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
clg/tree
Package tree stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
Package tree stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
destination
Package destination stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
Package destination stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
expectation
Package expectation stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
Package expectation stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
session
Package session stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
Package session stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
source
Package source stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
Package source stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
stage
Package stage stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
Package stage stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
first
behaviour
Package behaviour stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
Package behaviour stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
information
Package information stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
Package information stores and accesses the values defined in this package in and from a github.com/the-anna-project/context.Context.
Package merge provides merging of a list of contexts to a single context based on specific rules.
Package merge provides merging of a list of contexts to a single context based on specific rules.

Jump to

Keyboard shortcuts

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