plugins

package module
v0.1.1-0...-3a92c13 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const StatusInfoLog = 101

StatusInfoLog is used to mark a INFO log message from the server.

Variables

This section is empty.

Functions

func FromMap

func FromMap[T any](m map[string]any) (T, error)

FromNMap converts m to T. See https://pkg.go.dev/github.com/mitchellh/mapstructure#section-readme

Types

type Dispatcher

type Dispatcher interface {
	Infof(format string, args ...interface{})
}

type Error

type Error struct {
	Msg string `toml:"msg"`
}

Error holds an error message.

func NewError

func NewError(what string, err error) *Error

Error is an error that can be returned from a plugin, it's main quality is that it can be marshalled to and from TOML/JSON etc.

func (Error) Error

func (r Error) Error() string

type Heartbeater

type Heartbeater[R any] interface {
	HeartbeatResponse() (R, bool)
}

type Server

type Server[Q, R any] struct {
	*execrpc.Server[Q, R]
}

func NewServer

func NewServer[Q Heartbeater[R], R any](call func(Dispatcher, Q) R) (*Server[Q, R], error)

NewServer creates a new server which will call the given function with a request Q. The Dispatcher an be used for logging. Any errors needs to be sent in R.

Directories

Path Synopsis
archiveplugins
deb Module

Jump to

Keyboard shortcuts

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