runtime

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(genPlugin GenPlugin, magic string, version uint32, serviceBase Service) error

Run is the entrypoint for the plugin implementation. You must pass your implementation wrapped in your generated plugin to this function. Run will block forever.

Types

type GenPlugin

type GenPlugin interface {
	Link(srv Service) (proto.Message, GenPluginMethod, error)
}

GenPlugin is a generated plugin instance from protoc-gen-plug.

type GenPluginMethod

type GenPluginMethod func(proto.Message) (proto.Message, error)

GenPluginMethod is used internally to link plugin methods from protoc-gen-plug to the plugin runtime.

type Host

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

Host is the internal host interface for communicating with the plugin. It should not be used by the plugin consumer, they should interface directly with the generated host implementation.

func Load

func Load(filename string, magic string, version uint32, serviceBase Service) (*Host, error)

Load is used to launch the plugin subprocess and to wrap the transport logic. It should not be used directly by a user, it is referenced in the code that is generated by `protoc-gen-plug`.

func Test

func Test(genPlugin GenPlugin, magic string, version uint32, serviceBase Service) (*Host, error)

TestPlugin creates a communication pipes just like launching the plugin normally, but instead of running from a sub-process it simply runs the plugin in a go-routine.

func (*Host) SendRecv

func (c *Host) SendRecv(srv Service, req, resp proto.Message) error

SendRecv is used by the generated host implementation to communicate with the plugin. Do not use this manually unless you want to break your program.

type Service

type Service uint16

Service is used to enumerate the available services for the plugin transport. It is used by the generated code from `protoc-gen-plug` and should not be needed by a plugin consumer or author.

Jump to

Keyboard shortcuts

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