types

package
v0.0.0-...-569b2ae Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call struct {
	Method     func() (string, error) `json:"method"` // Used to call method
	MethodHash string                 `json:"hash"`   // Used to identify call

	Endpoint string `json:"endpoint"` // Used for calls to rpc
}

Call - call to specified method

func NewCall

func NewCall(method func() (string, error), receiver interface{}, endpoint string) (*Call, error)

NewCall - initialize new instance of Call struct

func (*Call) Run

func (call *Call) Run() (string, error)

Run - attempt to run specified call

type Environment

type Environment struct {
	Stacks []*Stack `json:"stacks"` // Fetch reference to Environment stacks
	Calls  []*Call  `json:"calls"`  // Used for storing single-reference calls (not in stacks)
}

Environment - stack-based container capable of holding memory-only runtime values

func NewEnvironment

func NewEnvironment(endpoint string) *Environment

NewEnvironment - initialize and return new instance of Environment struct

func (*Environment) AddCall

func (env *Environment) AddCall(call *Call) error

AddCall - attempt to append call to environment list of calls

func (*Environment) AddStack

func (env *Environment) AddStack(stack *Stack) error

AddStack - attempt to append stack to environment list of stacks

func (*Environment) SearchCallEndpoints

func (env *Environment) SearchCallEndpoints(endpoint string) (*Call, error)

SearchCallEndpoints - query for endpoint in environment calls

func (*Environment) SearchStackEndpoints

func (env *Environment) SearchStackEndpoints(endpoint string) (*Stack, error)

SearchStackEndpoints - query for endpoint in environment stacks

type Stack

type Stack struct {
	Calls    []*Call        `json:"calls"`    // Used for referencing and running Stack calls
	Endpoint string         `json:"endpoint"` // Used for http call references
	Memory   []*interface{} `json:"memory"`   // Used for value storage
}

Stack - struct used for referencing/running multiple calls at once

func NewStack

func NewStack(endpoint string) *Stack

NewStack - initialize new instance of Stack type

func (*Stack) AddCall

func (stack *Stack) AddCall(call *Call) error

AddCall - attempt to append call to stack

func (*Stack) AddToMemory

func (stack *Stack) AddToMemory(value *interface{})

AddToMemory - attempt to add specified value to stack memory

func (*Stack) Run

func (stack *Stack) Run() (string, error)

Run - iterate through stack, run each call

Jump to

Keyboard shortcuts

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