pluginkit

package module
v0.0.0-...-85f6ae7 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 6 Imported by: 0

README

Dogma Plugin Toolkit

Build Status Code Coverage Latest Version Documentation Go Report Card

Load Dogma applications as plugins.

Documentation

Overview

Package pluginkit defines the Dogma application plugin API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationService

type ApplicationService interface {
	// ApplicationKeys returns the identity keys of the applications that can be
	// created via this service.
	ApplicationKeys() []string

	// NewApplication returns a new instance of an application.
	//
	// k is the application's identity key. It returns an error if k is not one
	// of the keys returned by ApplicationKeys().
	//
	// The returned io.Closer, if non-nil, is used to free any resources
	// allocated for the application, such as closing database connections.
	NewApplication(ctx context.Context, k string) (dogma.Application, io.Closer, error)
}

ApplicationService is a plugin service that can instantiate Dogma applications.

type Plugin

type Plugin interface {
	// File returns the path to the plugin file, as passed to Load().
	File() string

	// ApplicationService returns the plugin's ApplicationService, if it is
	// implemented.
	ApplicationService() (ApplicationService, bool)

	// Close closes the plugin.
	Close() error
}

Plugin is an interface for using services provided by a Dogma plugin.

func Load

func Load(ctx context.Context, file string) (Plugin, error)

Load returns a Dogma plugin loaded from a file.

Directories

Path Synopsis
lib

Jump to

Keyboard shortcuts

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