Documentation
¶
Index ¶
- type Discovery
- type EventHandler
- type MicroDiscovery
- func (d *MicroDiscovery) AddModuleWatch(module string) error
- func (d *MicroDiscovery) DeleteModuleWatch(module string) error
- func (d *MicroDiscovery) GetModuleServer(module string) (*registry.Service, error)
- func (d *MicroDiscovery) GetRandomServerInstance(module string) (*registry.Node, error)
- func (d *MicroDiscovery) ListAllServer() ([]*registry.Service, error)
- func (d *MicroDiscovery) RegisterEventFunc(handleFunc EventHandler)
- func (d *MicroDiscovery) Start() error
- func (d *MicroDiscovery) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Discovery ¶
type Discovery interface { // Start to work Start() error //GetModuleServer get local watch module: types.BCS_MODULE_SCHEDULER... //if mesos-apiserver/k8s-apiserver module=clusterId.{module}, for examples: 10001.mesosdriver GetModuleServer(module string) (*registry.Service, error) // GetRandomServerInstance get random one instance of local cache server information //if mesos-apiserver/k8s-apiserver module=clusterId.{module}, for examples: 10001.mesosdriver GetRandomServerInstance(module string) (*registry.Node, error) //ListAllServer list all registed server information ListAllServer() ([]*registry.Service, error) // AddModuleWatch add new watch for specified module, Discovery will cache watched module info AddModuleWatch(module string) error // DeleteModuleWatch clean watch for specified module DeleteModuleWatch(module string) error // RegisterEventFunc register event handle function RegisterEventFunc(handleFunc EventHandler) // Stop close module discovery Stop() }
Discovery grpc discovery definition, interface is designed for multiple module discovery.
func NewDiscovery ¶
func NewDiscovery(modules []string, handler EventHandler, r registry.Registry) Discovery
NewDiscovery create micro discovery implementation @param modules, bkbcs modules define in common/types, meshmanager, logmanager, mesosdriver and etc. @param handler, event callback @param r, go-micro registry implementation
type EventHandler ¶
type EventHandler func(module string)
EventHandler callback function when server changes
type MicroDiscovery ¶
MicroDiscovery bkbcs go micro discovery implementation
func (*MicroDiscovery) AddModuleWatch ¶
func (d *MicroDiscovery) AddModuleWatch(module string) error
AddModuleWatch add new watch for specified module, Discovery will cache watched module info @param: module, bkbcs module name, such as meshmanager, logmanager, storage etc.
func (*MicroDiscovery) DeleteModuleWatch ¶
func (d *MicroDiscovery) DeleteModuleWatch(module string) error
DeleteModuleWatch clean watch for specified module
func (*MicroDiscovery) GetModuleServer ¶
func (d *MicroDiscovery) GetModuleServer(module string) (*registry.Service, error)
GetModuleServer module: types.BCS_MODULE_SCHEDULER... if mesos-apiserver/k8s-apiserver module=clusterId.{module}, for examples: 10001.mesosdriver, storage
func (*MicroDiscovery) GetRandomServerInstance ¶
func (d *MicroDiscovery) GetRandomServerInstance(module string) (*registry.Node, error)
GetRandomServerInstance get random one instance of server if mesos-apiserver/k8s-apiserver module=clusterId.{module}, for examples: 10001.mesosdriver, storage
func (*MicroDiscovery) ListAllServer ¶
func (d *MicroDiscovery) ListAllServer() ([]*registry.Service, error)
ListAllServer list all registed server information
func (*MicroDiscovery) RegisterEventFunc ¶
func (d *MicroDiscovery) RegisterEventFunc(handleFunc EventHandler)
RegisterEventFunc register event handle function
func (*MicroDiscovery) Start ¶
func (d *MicroDiscovery) Start() error
Start init all necessary resource