utils

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: Apache-2.0 Imports: 7 Imported by: 7

Documentation

Index

Constants

View Source
const ActionKey = "action"

ActionKey is used by ActionTagger as the Key in the Tag it appends

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionTagger added in v0.18.0

type ActionTagger struct{}

ActionTagger will inspect the message being executed and add a tag `action = msg.Path()`. This should be applied as a decorator so clients have a standard way to search / subscribe to eg. proposal creation.

Note that for best results, this should be at the end of the ChainDecorators call, after Batch (so it is tagged with each submessage type). You will also want to wrap the governance router with this, so the result of a successful election will be tagged (and there won't be validators.ApplyDiffMsg being executed that do not show up in a search).

func NewActionTagger added in v0.18.0

func NewActionTagger() ActionTagger

NewActionTagger creates a ActionTagger decorator

func (ActionTagger) Check added in v0.18.0

Check just passes the request along

func (ActionTagger) Deliver added in v0.18.0

Deliver appends a tag on the result if there is a success.

type KeyTagger added in v0.2.1

type KeyTagger struct{}

KeyTagger is a decorate that records all Set/Delete operations performed by it's children and adds all those keys as DeliverTx tags.

Tags is the hex encoded key, value is "s" (for set) or "d" (for delete)

Desired behavior, impossible as tendermint will collapse multiple tags with same key:

Tags are added as Key=<bucket name>, Value=<hex of remainder>,
like Key=cash, Value=00CAFE00

func NewKeyTagger added in v0.2.1

func NewKeyTagger() KeyTagger

NewKeyTagger creates a KeyTagger decorator

func (KeyTagger) Check added in v0.2.1

func (KeyTagger) Check(ctx weave.Context, db weave.KVStore, tx weave.Tx, next weave.Checker) (*weave.CheckResult, error)

Check does nothing

func (KeyTagger) Deliver added in v0.2.1

Deliver passes in a recording KVStore into the child and uses that to calculate tags to add to DeliverResult

type Logging

type Logging struct{}

Logging is a decorator to log messages as they pass through

func NewLogging

func NewLogging() Logging

NewLogging creates a Logging decorator

func (Logging) Check

func (r Logging) Check(ctx weave.Context, store weave.KVStore, tx weave.Tx, next weave.Checker) (*weave.CheckResult, error)

Check logs error -> info, success -> debug

func (Logging) Deliver

func (r Logging) Deliver(ctx weave.Context, store weave.KVStore, tx weave.Tx, next weave.Deliverer) (*weave.DeliverResult, error)

Deliver logs error -> error, success -> info

type Recovery

type Recovery struct{}

Recovery is a decorator to recover from panics in transactions, so we can log them as errors

func NewRecovery

func NewRecovery() Recovery

NewRecovery creates a Recovery decorator

func (Recovery) Check

func (r Recovery) Check(ctx weave.Context, store weave.KVStore, tx weave.Tx, next weave.Checker) (_ *weave.CheckResult, err error)

Check turns panics into normal errors

func (Recovery) Deliver

func (r Recovery) Deliver(ctx weave.Context, store weave.KVStore, tx weave.Tx, next weave.Deliverer) (_ *weave.DeliverResult, err error)

Deliver turns panics into normal errors

type Savepoint

type Savepoint struct {
	// contains filtered or unexported fields
}

Savepoint will isolate all data inside of the call, and commit/rollback to savepoint based on if error

func NewSavepoint

func NewSavepoint() Savepoint

NewSavepoint creates a Savepoint decorator, but you must call OnCheck/OnDeliver so it will be triggered

func (Savepoint) Check

func (s Savepoint) Check(ctx weave.Context, store weave.KVStore, tx weave.Tx, next weave.Checker) (*weave.CheckResult, error)

Check will optionally set a checkpoint

func (Savepoint) Deliver

func (s Savepoint) Deliver(ctx weave.Context, store weave.KVStore, tx weave.Tx, next weave.Deliverer) (*weave.DeliverResult, error)

Deliver will optionally set a checkpoint

func (Savepoint) OnCheck

func (s Savepoint) OnCheck() Savepoint

OnCheck returns a savepoint that will trigger on CheckTx

func (Savepoint) OnDeliver

func (s Savepoint) OnDeliver() Savepoint

OnDeliver returns a savepoint that will trigger on DeliverTx

Jump to

Keyboard shortcuts

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