plugo

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 11 Imported by: 7

README

plugo

A plugin library for Go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugo

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

func New

func New(plugoId string) (*Plugo, error)

This function creates a plugo. plugoId should be unique to avoid conflicts with other plugos.

func (*Plugo) CallWithContext added in v0.4.0

func (plugo *Plugo) CallWithContext(
	plugoId string,
	functionId string,
	ctx context.Context,
	arguments ...any,
) ([]any, error)

This function remotely calls functions exposed by connected plugos. plugoId is the name of the connected plugo whose exposed function should be called. functionId is the Id of the function that should be called (not necessarily the function name). ctx is a context that can be used to construct a timeout. arguments are what the remote function will be passed as arguments.

func (*Plugo) CallWithTimeout added in v0.4.0

func (plugo *Plugo) CallWithTimeout(
	plugoId string,
	functionId string,
	timeout int,
	arguments ...any,
) ([]any, error)

This function remotely calls functions exposed by connected plugos. plugoId is the name of the connected plugo whose exposed function should be called. functionId is the Id of the function that should be called (not necessarily the function name). timeout is the amount of time in milliseconds the function will wait for a reply from the called remote function, and arguments are what the remote function will be passed as arguments.

func (*Plugo) CheckConnection added in v0.4.0

func (plugo *Plugo) CheckConnection(plugoId string) bool

func (*Plugo) Expose

func (plugo *Plugo) Expose(functionId string, function any)

This function exposes the given function to connected plugos. If f is of type func(...any) []any it will be not be called using reflect, resulting in better performance. functionId is the Id through which other plugos may call the function using the plugo.Call() function.

func (*Plugo) Ready added in v0.5.0

func (plugo *Plugo) Ready() error

This function send informs the parent plugo that this plugo has finished setting up and that the parent plugo should continue its execution.

func (*Plugo) Shutdown added in v0.2.0

func (plugo *Plugo) Shutdown()

This function gracefully shuts the plugo down. It stops listening for incoming connections and closes all existing connections.

func (*Plugo) StartChildren added in v0.4.0

func (plugo *Plugo) StartChildren(folderName string)

func (*Plugo) Unexpose added in v0.4.0

func (plugo *Plugo) Unexpose(functionId string)

This function unexposes the function with the given functionId.

Jump to

Keyboard shortcuts

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