hook

package
v0.0.0-...-8444db5 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceName service.Name = "hook"
)

Variables

This section is empty.

Functions

func InvokeBackendModulesHook

func InvokeBackendModulesHook(ctx context.Context, reg *plugin.Registry, factories []app.BackendModuleFactory) ([]app.BackendModuleFactory, error)

InvokeBackendModulesHook invokes the registered plugins implementing the BackendModules interface and extending backend modules factories.

func InvokeBackendModulesHookWithContext

func InvokeBackendModulesHookWithContext(ctx context.Context, factories []app.BackendModuleFactory) ([]app.BackendModuleFactory, error)

InvokeBackendModulesHookWithContext extracts hook.Service from the given context and returns the InvokeBackendModulesHook result.

func InvokeCommandsHook

func InvokeCommandsHook(ctx context.Context, reg *plugin.Registry, commands []*cli.Command) ([]*cli.Command, error)

func InvokeConfigHook

func InvokeConfigHook(ctx context.Context, reg *plugin.Registry, config map[string]map[string]interface{}) error

InvokeConfigHook invokes plugins implementing the Config interface with their associated configuration options.

func InvokeDumpConfigHook

func InvokeDumpConfigHook(ctx context.Context, config *config.Config) error

InvokeDumpConfigHook invokes plugins implementing the DumpConfig interface.

func InvokeMountRoutesHook

func InvokeMountRoutesHook(ctx context.Context, r chi.Router) error

func ServiceProvider

func ServiceProvider(registry *plugin.Registry) service.Provider

Types

type BackendModules

type BackendModules interface {
	// HookBackendModules handles backend modules factories and
	// returns a modified version, if necessary.
	HookBackendModules(ctx context.Context, factories []app.BackendModuleFactory) ([]app.BackendModuleFactory, error)
}

HookBackendModules is an interface allowing compatible plugins to modify apps backend exposed modules.

type Commands

type Commands interface {
	// HookCommands handles default commands
	// returns a modified slice of commands, if necessary.
	HookCommands(ctx context.Context, defaultCommands []*cli.Command) ([]*cli.Command, error)
}

Commands is an interface allowing compatible plugins to modify available commands.

type Config

type Config interface {
	// ConfigureHook handles plugins configuration options given by the host process.
	HookConfig(ctx context.Context, options map[string]interface{}) error
}

Config is an interface allowing compatible plugins to receive configuration options on application startup.

type DumpConfig

type DumpConfig interface {
	// HookDumpConfig handles configuration file dump
	HookDumpConfig(ctx context.Context) (map[string]interface{}, error)
}

HookConfig is an interface allowing compatible plugins to dump configuration options on 'dump-config' command execution.

type MountRoutes

type MountRoutes interface {
	// HookMountRoutes handles the chi.Router used by the http server
	HookMountRoutes(ctx context.Context, r chi.Router) error
}

HookMountRoutes is an interface allowing compatible plugins to mount additional http routes.

type Service

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

func From

func From(container *service.Container) (*Service, error)

From retrieves the hook service in the given service container

func Must

func Must(container *service.Container) *Service

Must retrieves the hook service in the given service container or panic otherwise

func (*Service) Plugins

func (s *Service) Plugins() *plugin.Registry

Jump to

Keyboard shortcuts

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