statebag

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2015 License: MPL-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bag

type Bag struct {
	// Data is the data inside the state bag. This shouldn't be set
	// directly. The Get and Set methods should be used instead. Accessing
	// it directly can result in undefined behavior.
	Data map[string]interface{}
}

Bag is a collection of state accessible by key. It is effectively a hash table that has slightly richer higher level functions built on top.

Otto uses this throughout the core system in order to pass arbitrary data around.

A Bag is not thread-safe. Concurrent read/write access should be protected by a lock. Concurrent read-only access is safe.

NOTE: At time of writing, this is basically just syntactic sugar over a hash. Richer methods will be added over time.

func (*Bag) Get

func (b *Bag) Get(k string) (interface{}, bool)

Get reads data from the state bag

func (*Bag) Set

func (b *Bag) Set(k string, v interface{})

Set sets data into the state bag

Jump to

Keyboard shortcuts

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