goplugin

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package goplugin - golang plugin in docker runner

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoPlugin

type GoPlugin struct {
	Options       Options
	RunnerOptions RunnerOptions
	MessageRouter MessageRouter
	// contains filtered or unexported fields
}

GoPlugin is a logic runner of code written in golang and compiled as go plugins

func NewGoPlugin

func NewGoPlugin(options Options, runnerOptions RunnerOptions, mr MessageRouter) (*GoPlugin, error)

NewGoPlugin returns a new started GoPlugin

func (*GoPlugin) Exec

func (gp *GoPlugin) Exec(codeRef logicrunner.Reference, data []byte, method string, args logicrunner.Arguments) ([]byte, logicrunner.Arguments, error)

Exec runs a method on an object in controlled environment

func (*GoPlugin) Start

func (gp *GoPlugin) Start()

Start starts RPC interface to help runner, note that NewGoPlugin does this for you

func (*GoPlugin) StartRunner added in v0.0.4

func (gp *GoPlugin) StartRunner() error

StartRunner starts ginsider process

func (*GoPlugin) Stop

func (gp *GoPlugin) Stop()

Stop stops runner(s) and RPC service

type MessageRouter added in v0.0.4

type MessageRouter interface {
	Route(ctx hostnetwork.Context, msg messagerouter.Message) (resp messagerouter.Response, err error)
}

MessageRouter interface

type Options

type Options struct {
	// Listen  is address `GoPlugin` listens on and provides RPC interface for runner(s)
	Listen string
	// CodePath is path to directory with plugin's code, this should go away at some point
	CodePath string
}

Options of the GoPlugin

type RPC

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

RPC is a RPC interface for runner to use for various tasks, e.g. code fetching

func (*RPC) GetObject

func (gpr *RPC) GetObject(ref logicrunner.Reference, reply *logicrunner.Object) error

GetObject is an RPC retrieving an object by its reference, so far short circuted to return code of the plugin

func (*RPC) RouteCall added in v0.0.4

func (gpr *RPC) RouteCall(req rpctypes.UpRouteReq, reply *rpctypes.UpRouteResp) error

RouteCall routes call from a contract to a contract through message router

type RunnerOptions

type RunnerOptions struct {
	// Listen is address the runner listens on and provides RPC interface for the `GoPlugin`
	Listen string
	// CodeStoragePath is path to directory where the runner caches code
	CodeStoragePath string
}

RunnerOptions - set of options to control internal isolated code runner(s)

Directories

Path Synopsis
testplugins
foundation
Package foundation emulates foundation of types for golang contracts
Package foundation emulates foundation of types for golang contracts

Jump to

Keyboard shortcuts

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