Documentation ¶
Index ¶
- type Plugo
- func (plugo *Plugo) CallWithContext(plugoId string, functionId string, ctx context.Context, arguments ...any) ([]any, error)
- func (plugo *Plugo) CallWithTimeout(plugoId string, functionId string, timeout int, arguments ...any) ([]any, error)
- func (plugo *Plugo) CheckConnection(plugoId string) bool
- func (plugo *Plugo) Expose(functionId string, function any)
- func (plugo *Plugo) Ready() error
- func (plugo *Plugo) Shutdown()
- func (plugo *Plugo) StartChildren(folderName string)
- func (plugo *Plugo) Unexpose(functionId string)
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 ¶
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) Expose ¶
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
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.