runner

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutableStore added in v0.2.0

type ExecutableStore interface {
	Load(string) (*[]byte, error)
	Add(string, *[]byte) error
	Exists(string) (bool, error)
	GetPath(string) string
}

type ExecutableStoreFilesystem added in v0.2.0

type ExecutableStoreFilesystem struct {
	Root string
}

func (ExecutableStoreFilesystem) Add added in v0.2.0

func (s ExecutableStoreFilesystem) Add(p string, b *[]byte) error

func (ExecutableStoreFilesystem) Exists added in v0.2.0

func (s ExecutableStoreFilesystem) Exists(p string) (bool, error)

func (ExecutableStoreFilesystem) GetPath added in v0.2.0

func (ExecutableStoreFilesystem) Load added in v0.2.0

func (s ExecutableStoreFilesystem) Load(p string) (*[]byte, error)

type Execute

type Execute func() string

type Greeter added in v0.2.0

type Greeter interface {
	Greet() Response
}

Greeter is the interface that we're exposing as a plugin.

type GreeterPlugin added in v0.2.0

type GreeterPlugin struct {
	// Impl Injection
	Impl Greeter
}

This is the implementation of plugin.Plugin so we can serve/consume this

This has two methods: Server must return an RPC server for this plugin type. We construct a GreeterRPCServer for this.

Client must return an implementation of our interface that communicates over an RPC client. We return GreeterRPC for this.

Ignore MuxBroker. That is used to create more multiplexed streams on our plugin connection and is a more advanced use case.

func (GreeterPlugin) Client added in v0.2.0

func (GreeterPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (*GreeterPlugin) Server added in v0.2.0

func (p *GreeterPlugin) Server(*plugin.MuxBroker) (interface{}, error)

type GreeterRPC added in v0.2.0

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

Here is an implementation that talks over RPC

func (*GreeterRPC) Greet added in v0.2.0

func (g *GreeterRPC) Greet() string

type GreeterRPCServer added in v0.2.0

type GreeterRPCServer struct {
	// This is the real implementation
	Impl Greeter
}

Here is the RPC server that GreeterRPC talks to, conforming to the requirements of net/rpc

func (*GreeterRPCServer) Greet added in v0.2.0

func (s *GreeterRPCServer) Greet(args interface{}, resp *Response) error

type Response added in v0.2.0

type Response struct {
	String string
}

type Runnable

type Runnable interface {
	Build(ExecutableStore) error
	Run(ExecutableStore) error
	Stop() error
}

type RunnableEndpoint added in v0.2.0

type RunnableEndpoint struct {
	Addr net.Addr
	Pid  int
}

type SimpleRunnable

type SimpleRunnable struct {
	Name string
	//Code     []byte
	Location string
	Client   *plugin.Client
	KV       shared.KV
}

func GetRunnableForProject added in v0.2.0

func GetRunnableForProject(p *models.Service) (SimpleRunnable, error)

func (*SimpleRunnable) Attach added in v0.2.0

func (r *SimpleRunnable) Attach(endpoint string, pid int) error

func (SimpleRunnable) Build

func (r SimpleRunnable) Build(store ExecutableStore) error

func (*SimpleRunnable) Execute added in v0.2.0

func (r *SimpleRunnable) Execute(s string) (string, error)

func (*SimpleRunnable) FilePath added in v0.2.0

func (s *SimpleRunnable) FilePath() string

func (*SimpleRunnable) IsUp added in v0.2.0

func (r *SimpleRunnable) IsUp() (bool, error)

func (*SimpleRunnable) Run

func (*SimpleRunnable) RunForever added in v0.2.0

func (r *SimpleRunnable) RunForever(store ExecutableStore) error

func (*SimpleRunnable) RunPlugin added in v0.2.0

func (r *SimpleRunnable) RunPlugin(path string, ac chan *plugin.ReattachConfig)

func (SimpleRunnable) Stop added in v0.2.0

func (r SimpleRunnable) Stop() error

Directories

Path Synopsis
Package shared contains shared data between the host and plugins.
Package shared contains shared data between the host and plugins.

Jump to

Keyboard shortcuts

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