plugin

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BUILDIN = "buildin"
	STATIC  = "static"
	DYNAMIC = "dynamic"
)

Variables

This section is empty.

Functions

func DynamicPluginFunc

func DynamicPluginFunc(pn Name, funcName string) pg.Symbol

DynamicPluginFunc should be called in buildin implement

func LoadPlugins

func LoadPlugins()

LoadPlugins loads and sets all the plugin interfaces's instance.

func RegisterPlugin

func RegisterPlugin(p Plugin)

RegisterPlugin registers a 'Plugin'.

Types

type ImplName

type ImplName string

ImplName is an alias,it represents a plugin interface implementation.

type Instance

type Instance interface{}

Instance is an instance of a plugin interface which is represented by Name.

type Manager

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

Manager manages plugin instance generation. Manager keeps the plugin instance currently used by server for every plugin interface.

func Plugins

func Plugins() *Manager

Plugins returns the 'Manager'.

func (*Manager) AuditLog

func (pm *Manager) AuditLog() auditlog.AuditLogger

func (*Manager) Auth

func (pm *Manager) Auth() auth.Auth

func (*Manager) Cipher

func (pm *Manager) Cipher() security.Cipher

func (*Manager) Discovery

func (pm *Manager) Discovery() discovery.AdaptorRepository

func (*Manager) Get

func (pm *Manager) Get(pn Name, name ImplName) *Plugin

Get gets a 'Plugin'

func (*Manager) Initialize

func (pm *Manager) Initialize()

Initialize initializes the struct

func (*Manager) Instance

func (pm *Manager) Instance(pn Name) Instance

Instance gets an plugin instance. What plugin instance you get is depended on the supplied go plugin files (high priority) or the plugin config(low priority)

The go plugin file should be {plugins_dir}/{Name}_plugin.so. ('plugins_dir' must be configured as a valid path in service-center config.) The plugin config in service-center config should be: {Name}_plugin = {ImplName}

e.g. For registry plugin, you can set a config in app.conf: plugins_dir = /home, and supply a go plugin file: /home/registry_plugin.so; or if you want to use etcd as registry, you can set a config in app.conf: registry_plugin = etcd.

func (*Manager) New

func (pm *Manager) New(pn Name)

New initializes and sets the instance of a plugin interface, but not returns it. Use 'Instance' if you want to get the plugin instance. We suggest you to use 'Instance' instead of 'New'.

func (*Manager) Quota

func (pm *Manager) Quota() quota.Manager

func (*Manager) Register

func (pm *Manager) Register(p Plugin)

Register registers a 'Plugin' unsafe

func (*Manager) Registry

func (pm *Manager) Registry() registry.Registry

func (*Manager) Reload

func (pm *Manager) Reload(pn Name)

Reload reloads the instance of the specified plugin interface.

func (*Manager) ReloadAll

func (pm *Manager) ReloadAll()

ReloadAll reloads all the plugin instances

func (*Manager) TLS

func (pm *Manager) TLS() tls.TLS

func (*Manager) Tracing

func (pm *Manager) Tracing() (v tracing.Tracing)

func (*Manager) UUID

func (pm *Manager) UUID() uuid.UUID

type Name

type Name int

Name is an alias, it represents a plugin interface.

const (
	UUID Name = iota
	AuditLog
	AUTH
	CIPHER
	QUOTA
	REGISTRY
	TRACING
	TLS
	DISCOVERY
)

func (Name) ActiveConfigs

func (pn Name) ActiveConfigs() util.JSONObject

ActiveConfigs returns all the server's plugin config

func (Name) ClearConfigs

func (pn Name) ClearConfigs()

ClearConfigs clears the server's plugin config

func (Name) String

func (pn Name) String() string

String implements fmt.Stringer.

type Plugin

type Plugin struct {
	PName Name
	Name  ImplName
	// New news an instance of 'PName' represented plugin interface
	New func() Instance
}

Plugin generates a plugin instance Plugin holds the 'Name' and 'ImplName' to manage the plugin instance generation.

Directories

Path Synopsis
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.
etcd
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.
k8s
security
tls

Jump to

Keyboard shortcuts

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