v3.6.1+incompatible Latest Latest

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

Go to latest
Published: Jul 11, 2018 License: LGPL-3.0 Imports: 8 Imported by: 25




This section is empty.


This section is empty.


func RegistPlugin

func RegistPlugin(name string, c Creater)

RegistPlugin regist a plugin

func RegistPluginOptionCheck

func RegistPluginOptionCheck(name string, c Checker)

RegistPluginOptionCheck regist the options check


type Checker

type Checker func(Context) error

Checker the opts

type Context

type Context struct {
	Store  store.ReadStore
	Option map[string]string
	Ctx    context.Context

Context plugin context

type Creater

type Creater func(Context) (Plugin, error)

Creater lb plugin creater

type LBPluginFactory

type LBPluginFactory struct {
	// contains filtered or unexported fields

LBPluginFactory plugin factory

type Manager

type Manager struct {
	// contains filtered or unexported fields

Manager lb plugin manager

func NewPluginManager

func NewPluginManager(config option.Config) (*Manager, error)

NewPluginManager new lb plugin manager

func (*Manager) GetDefaultPlugin

func (m *Manager) GetDefaultPlugin(store store.ReadStore) (Plugin, error)

GetDefaultPlugin get default plugin

func (*Manager) GetPlugin

func (m *Manager) GetPlugin(name string, opts map[string]string, store store.ReadStore) (Plugin, error)

GetPlugin get plugin from name if name is not exist, will create it

func (*Manager) Stop

func (m *Manager) Stop()

Stop stop all plugin

type Plugin

type Plugin interface {
	AddPool(pools ...*object.PoolObject) error
	UpdatePool(pools ...*object.PoolObject) error
	DeletePool(pools ...*object.PoolObject) error
	GetPool(name string) *object.PoolObject

	UpdateNode(nodes ...*object.NodeObject) error
	DeleteNode(nodes ...*object.NodeObject) error
	AddNode(nodes ...*object.NodeObject) error
	GetNode(name string) *object.NodeObject

	UpdateRule(rules ...*object.RuleObject) error
	DeleteRule(rules ...*object.RuleObject) error
	AddRule(rules ...*object.RuleObject) error
	GetRule(name string) *object.RuleObject

	AddDomain(domains ...*object.DomainObject) error
	UpdateDomain(domains ...*object.DomainObject) error
	DeleteDomain(domains ...*object.DomainObject) error
	GetDomain(name string) *object.DomainObject

	GetName() string
	Stop() error

	AddVirtualService(services ...*object.VirtualServiceObject) error
	UpdateVirtualService(services ...*object.VirtualServiceObject) error
	DeleteVirtualService(services ...*object.VirtualServiceObject) error
	GetVirtualService(name string) *object.VirtualServiceObject
	//GetPluginStatus 获取插件状态,用于监控
	GetPluginStatus() bool

	AddCertificate(cas ...*object.Certificate) error
	DeleteCertificate(cas ...*object.Certificate) error

Plugin plugin interface 设计注意事项 1.需要先创建pool,再添加node 2.需要先创建pool,再添加vs 3.如果删除pool,不需要再删除node 4.操作pool或者node时需要使用pool分布式锁


Path Synopsis

Jump to

Keyboard shortcuts

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