Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterServiceInfra ¶
func RegisterServiceInfra(name string, creator infraCreator)
Types ¶
type ChangedType ¶
type ChangedType int
ChangedType service info type
const ( ServiceAdd ChangedType = iota ServiceChange ServiceDelete )
type IServiceInfra ¶
type IServiceInfra interface { // Init will init service infra module with custom option Init(...Option) error // Start service-infra module, connect to soa center Start() error // Stop disconnect to soa center, remove all service cache Stop() error // Tick tick func called by logic goroutine Tick() //FindServiceAsync will find service asynchronous //It will call callback function which added by AddListener FindServiceAsync(svsName string) // FindService will find service from soa system by name FindService(svsName string) (*ServiceInfo, error) // RegisterService register service to soa RegisterService(svsName string, info *ServiceInfo) error // UnRegisterService unregister service UnRegisterService(svsName string, info *ServiceInfo) error //AddListener will store service changed callback by service name AddListener(handle ServiceEventHandle) error //DelListener del server event listener DelListener() error //IsConnected is connected to soa center IsConnected() bool }
IServiceInfra service finder and register interface
func CreateServiceInfra ¶
func CreateServiceInfra(name string) IServiceInfra
type Option ¶ added in v0.4.8
type Option func(*Options)
func WithAppendHost ¶ added in v0.4.8
func WithPrefix ¶ added in v0.4.8
type Options ¶ added in v0.4.8
type Options struct { //Prefix 路径前缀,支持多层级的路径 Prefix string `yaml:"prefix"` //Auth 鉴权接口,预留 Auth string //Hosts 发现用地址 Hosts []string `yaml:"hosts"` }
Options zookeeper模块配置
func (*Options) PreProcess ¶ added in v0.4.8
func (o *Options) PreProcess()
type ServiceEventHandle ¶
type ServiceEventHandle func(svsName string, eventType ChangedType, changeInfo *ChangedInfo, err error)
ServiceEventHandle service changed handler
type ServiceInfo ¶
type ServiceInfo struct {
Hosts []string // ip:port
}
ServiceInfo service info
func MakeServiceInfo ¶
func MakeServiceInfo(hosts []string) *ServiceInfo
MakeServiceInfo create service info with service list
Click to show internal directories.
Click to hide internal directories.