store

package
v5.0.1-release+incompa... Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: LGPL-3.0 Imports: 12 Imported by: 36

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTypeUnknown = errors.New("object type unknown")

ErrTypeUnknown unknown source type error

Functions

This section is empty.

Types

type Manager

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

Manager store manager

func NewManager

func NewManager(conf option.Config, cluster *cluster.Manager) (*Manager, error)

NewManager create a manager

func (*Manager) AddSource

func (m *Manager) AddSource(o object.Object) (bool, error)

AddSource save source if result=false and err==nil this entrance do not call plugin if result=true and err==nil this entrance need call plugin if result=false and err!=nil need retry or return err

func (*Manager) CreateMutex

func (m *Manager) CreateMutex(key string) *cluster.Mutex

CreateMutex Create a distributed lock

func (*Manager) DeleteSource

func (m *Manager) DeleteSource(o object.Object) (bool, error)

DeleteSource delete source if result=false and err==nil this entrance do not call plugin

func (*Manager) GetAllNodes

func (m *Manager) GetAllNodes() ([]*object.NodeObject, error)

GetAllNodes get all node data

func (*Manager) GetAllPools

func (m *Manager) GetAllPools() ([]*object.PoolObject, error)

GetAllPools 获取全部pools

func (*Manager) GetAllRule

func (m *Manager) GetAllRule(protocol string) ([]*object.RuleObject, error)

GetAllRule get all rules objects by protocol protocol could be http or https

func (*Manager) GetAllVSs

func (m *Manager) GetAllVSs() ([]*object.VirtualServiceObject, error)

GetAllVSs get all vs data

func (*Manager) GetCertificate

func (m *Manager) GetCertificate(certName string) (*object.Certificate, error)

Get cert key pair

func (*Manager) GetNodeByPool

func (m *Manager) GetNodeByPool(poolName string) ([]*object.NodeObject, error)

GetNodeByPool get all nodes objects by poolName

func (*Manager) GetPools

func (m *Manager) GetPools(poolNames map[string]string) ([]*object.PoolObject, error)

GetPools Gets the specified pool.

func (*Manager) GetRule

func (m *Manager) GetRule(rule *object.RuleObject) (*object.RuleObject, error)

GetRule get rule by *object.RuleObject

func (*Manager) GetRuleByPool

func (m *Manager) GetRuleByPool(protocol string, poolName string) ([]*object.RuleObject, error)

GetRuleByPool get all rules objects by pool name

func (*Manager) GetSource

func (m *Manager) GetSource(o object.Object) (object.Object, error)

GetSource get specified type source from etcd

func (*Manager) GetVSByPoolName

func (m *Manager) GetVSByPoolName(poolName string) (*object.VirtualServiceObject, error)

GetVSByPoolName get vs by pool name

func (*Manager) UpdateSource

func (m *Manager) UpdateSource(o object.Object) (bool, bool, error)

UpdateSource update source if result=false and err==nil this entrance do not call plugin if result=true and err==nil this entrance need call plugin if result=false and err!=nil need retry or return err return:isOnline/isCouldCallPlugin/error

func (*Manager) UpdateSourceOnline

func (m *Manager) UpdateSourceOnline(o object.Object, IsOnline bool) error

UpdateSourceOnline update source online status

type ReadStore

type ReadStore interface {
	//根据协议查询所有rule
	GetAllRule(protocol string) ([]*object.RuleObject, error)
	GetNodeByPool(poolName string) ([]*object.NodeObject, error)
	GetPools(poolNames map[string]string) ([]*object.PoolObject, error)
	GetRule(rule *object.RuleObject) (*object.RuleObject, error)
	GetRuleByPool(protocol string, poolName string) ([]*object.RuleObject, error)
	GetVSByPoolName(poolName string) (*object.VirtualServiceObject, error)
	GetCertificate(certName string) (*object.Certificate, error)
}

ReadStore 只读存储接口

type SourceInfo

type SourceInfo struct {
	Data       object.Object `json:"data"`
	Index      int64         `json:"index"`
	UpdateTime string        `json:"update_time"`
	Operation  string        `json:"operation"`
	//true: this source already call plugin
	IsOnline bool `json:"is_handle"`
}

SourceInfo source info

Jump to

Keyboard shortcuts

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