builtin

package
v0.0.2411 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

README

This package implements "built in" version of plugin loader and manager (see Veraison plugin framework. This removes runtime plugin discovery and loading (and, thus, any potential security issues associated with running external executables).

Instead, plugins are "discovered" at build time by iterating over an array of plugin implementations defined inside schemes.gen.go, which, in turn, can be (re-)generated by running gen-schemes script.

Note: gen-schemes script repeatedly invokes gopls and guru in order to identify plugin implementations. This means that it is very slow. Because of this, a static version of schemes.gen.go is currently submitted as part of the source.

Documentation

Overview

Copyright 2023 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0

Copyright 2023 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverBuiltin

func DiscoverBuiltin[I plugin.IPluggable]() error

func DiscoverBuiltinUsing

func DiscoverBuiltinUsing[I plugin.IPluggable](loader *BuiltinLoader) error

func GetBuiltinHandleByAttestationSchemeUsing

func GetBuiltinHandleByAttestationSchemeUsing[I plugin.IPluggable](
	ldr *BuiltinLoader,
	scheme string,
) (I, error)

func GetBuiltinHandleByMediaType

func GetBuiltinHandleByMediaType[I plugin.IPluggable](mediaType string) (I, error)

func GetBuiltinHandleByMediaTypeUsing

func GetBuiltinHandleByMediaTypeUsing[I plugin.IPluggable](
	ldr *BuiltinLoader,
	mediaType string,
) (I, error)

func GetBuiltinHandleByNameUsing

func GetBuiltinHandleByNameUsing[I plugin.IPluggable](ldr *BuiltinLoader, name string) (I, error)

func GetBuiltinLoadedAttestationSchemes

func GetBuiltinLoadedAttestationSchemes[I plugin.IPluggable](ldr *BuiltinLoader) []string

Types

type BuiltinLoader

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

func CreateBuiltinLoader

func CreateBuiltinLoader(
	cfg map[string]interface{},
	logger *zap.SugaredLogger,
) (*BuiltinLoader, error)

func NewBuiltinLoader

func NewBuiltinLoader(logger *zap.SugaredLogger) *BuiltinLoader

func (*BuiltinLoader) GetRegisteredMediaTypes

func (o *BuiltinLoader) GetRegisteredMediaTypes() []string

func (*BuiltinLoader) Init

func (o *BuiltinLoader) Init(m map[string]interface{}) error

type BuiltinManager

type BuiltinManager[I plugin.IPluggable] struct {
	// contains filtered or unexported fields
}

func CreateBuiltinManager

func CreateBuiltinManager[I plugin.IPluggable](
	v *viper.Viper,
	logger *zap.SugaredLogger,
	name string,
) (*BuiltinManager[I], error)

func CreateBuiltinManagerWithLoader

func CreateBuiltinManagerWithLoader[I plugin.IPluggable](
	loader *BuiltinLoader,
	logger *zap.SugaredLogger,
	name string,
) (*BuiltinManager[I], error)

func NewBuiltinManager

func NewBuiltinManager[I plugin.IPluggable](
	loader *BuiltinLoader,
	logger *zap.SugaredLogger,
) *BuiltinManager[I]

func (*BuiltinManager[I]) Close

func (o *BuiltinManager[I]) Close() error

func (*BuiltinManager[I]) GetRegisteredAttestationSchemes

func (o *BuiltinManager[I]) GetRegisteredAttestationSchemes() []string

func (*BuiltinManager[I]) GetRegisteredMediaTypes

func (o *BuiltinManager[I]) GetRegisteredMediaTypes() []string

func (*BuiltinManager[I]) Init

func (o *BuiltinManager[I]) Init(name string, ch *plugin.RPCChannel[I]) error

func (*BuiltinManager[I]) IsRegisteredMediaType

func (o *BuiltinManager[I]) IsRegisteredMediaType(mediaType string) bool

func (*BuiltinManager[I]) LookupByAttestationScheme

func (o *BuiltinManager[I]) LookupByAttestationScheme(scheme string) (I, error)

func (*BuiltinManager[I]) LookupByMediaType

func (o *BuiltinManager[I]) LookupByMediaType(mediaType string) (I, error)

func (*BuiltinManager[I]) LookupByName

func (o *BuiltinManager[I]) LookupByName(name string) (I, error)

Jump to

Keyboard shortcuts

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