plugin

package
v0.0.0-...-adc1ce0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternal = status.Errorf(codes.Internal, "internal server error")
	ErrNotFound = status.Errorf(codes.NotFound, "not found")
)

Functions

This section is empty.

Types

type BackendPlugin

type BackendPlugin interface {
	Plugin

	// Start should do final setup that requires a tear down e.g. setting
	// up connections and creating files. After Start is called the plugin
	// should be ready to receive messages.
	Start(cfg *cli.Context) error
	// Stop is the tear down counter part to Start. Stop should revert
	// states created by Start e.g. close connections or file descriptors.
	Stop() error

	Set(t string, r interface{}) error
	// Get retrieves one resource object. The metadata `m` will use
	// non-zero fields as a filter. The result is loaded into the object
	// passed through `retR`.
	Get(t string, m interface{}, retR interface{}) error
	// List returns the metadata of resources that matches non-zero fields
	// in the metadata `m`. `retM` gets assigned with the result. `retM` is
	// a slice of the resource type.
	List(t string, m interface{}, retM interface{}) error
	// Delete will remove the first resource object that matches non-zero
	// fields from `m`.
	Delete(t string, m interface{}, retR interface{}) error
}

type Cfg

type Cfg struct {
	Name        string
	Cli         []cli.Flag
	Interceptor grpc.UnaryServerInterceptor
}

type EventCBDelete

type EventCBDelete func(t string, m interface{})

type EventCBGet

type EventCBGet func(t string, m interface{})

type EventCBList

type EventCBList func(t string, m interface{})

type EventCBSet

type EventCBSet func(t string, r interface{})

type EventPlugin

type EventPlugin interface {
	Plugin

	RegisterCB() (EventCBSet, EventCBGet, EventCBList, EventCBDelete)
}

type InterceptorPlugin

type InterceptorPlugin interface {
	Plugin

	// Configure fetches arguments passed on the command line
	Configure(cfg *cli.Context) error
}

type Plugin

type Plugin interface {
	// Register is a preparation stage e.g. allocating resources and
	// preprocessing. Should not start connections or alike that requires
	// some kind if tear down this should be handled in Start.
	Register() (Cfg, error)
	// Cfg returns the plugin configuration. No work should be done in Cfg.
	Cfg() Cfg
}

Jump to

Keyboard shortcuts

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