client

package
v0.0.0-...-f631273 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(input interface{}) (map[string]interface{}, error)

Marshal returns the MESG format encoding of v.

func Unmarshal

func Unmarshal(input map[string]interface{}, output interface{}) error

Unmarshal parses the MESG-encoded data input and stores the result in the value pointed to by v.

Types

type Client

type Client struct {
	// all clients registered by mesg server.
	pb.EventClient
	pb.ExecutionClient
	pb.InstanceClient
	pb.ServiceClient

	// instance hash that could be used in api calls.
	InstanceHash []byte
}

Client is a client to connect to all mesg exposed API.

func New

func New() (*Client, error)

New creates a new client from env variables supplied by mesg engine.

func (*Client) TaskRunner

func (c *Client) TaskRunner() *TaskRunner

TaskRunner returns runner that could process execution without direct access to MESG api.

type TaskFn

type TaskFn func(inputs map[string]interface{}) (map[string]interface{}, error)

TaskFn is a task function handler prototype.

type TaskRunner

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

TaskRunner handles running task in a loop.

func (*TaskRunner) Add

func (r *TaskRunner) Add(name string, fn TaskFn)

Add sets new task handler. It overwrites previous one.

func (*TaskRunner) Run

func (r *TaskRunner) Run() error

Run recives executions and runs dedicated task for them.

Jump to

Keyboard shortcuts

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