plugins

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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