native

package
v0.0.0-...-917c650 Latest Latest
Warning

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

Go to latest
Published: May 15, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package native provides a Go native plugin loader.

Native Go plugins are only supported in Go 1.8+ and in Linux platforms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PluginLoader

type PluginLoader struct {

	// PluginDir is the directory where plugins will be loaded from
	PluginDir string
}

PluginLoader uses the plugin mechanism introduced in Go 1.8 to laod compiled plugins from a given directory.

func (*PluginLoader) Load

func (l *PluginLoader) Load(id string) (plugins.Plugin, error)

Load the given plugin using the native plugin support introduced in Go 1.8

Plugins must follow the plugin conventions:

  • Be present in the configured 'PluginDir/name.so' (plugin name in lowercase)
  • Must export a variable named 'Name' (the capitalized name of the plugin) of type 'enforcer.Plugin'

func (*PluginLoader) Unload

func (l *PluginLoader) Unload(id string) error

Unload releases the resources used by a plugin. In Go 1.8, closing an open plugin is still not supported, so this method does nothing.

Jump to

Keyboard shortcuts

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