static-node.go 895 字节
Newer Older
E
eoLinker API Management 已提交
1 2 3
package static

import (
黄孟柱 已提交
4 5
	"github.com/eolinker/goku-api-gateway/goku-service/common"
	"github.com/eolinker/goku-api-gateway/goku-service/discovery"
E
eoLinker API Management 已提交
6 7
)

Y
Your Name 已提交
8
//Driver driver
E
eoLinker API Management 已提交
9 10 11
type Driver struct {
}

Y
Your Name 已提交
12
//Open open
Y
Your Name 已提交
13
func (d *Driver) Open(name string, config string) (discovery.ISource, error) {
E
eoLinker API Management 已提交
14

Y
Your Name 已提交
15
	return NewStaticSources(name), nil
E
eoLinker API Management 已提交
16 17
}

Y
Your Name 已提交
18
//StaticDiscovery staticDiscovery
Y
Your Name 已提交
19
type Discovery struct {
E
eoLinker API Management 已提交
20 21
}

Y
Your Name 已提交
22
//SetConfig setConfig
Y
Your Name 已提交
23
func (d *Discovery) SetConfig(config string) error {
E
eoLinker API Management 已提交
24 25 26
	return nil
}

Y
Your Name 已提交
27
//Driver driver
Y
Your Name 已提交
28
func (d *Discovery) Driver() string {
E
eoLinker API Management 已提交
29 30 31
	return DriverName
}

Y
Your Name 已提交
32
//SetCallback setCallBack
Y
Your Name 已提交
33
func (d *Discovery) SetCallback(callback func(services []*common.Service)) {
E
eoLinker API Management 已提交
34 35 36
	return
}

Y
Your Name 已提交
37
//GetServers getServers
Y
Your Name 已提交
38
func (d *Discovery) GetServers() ([]*common.Service, error) {
Y
Your Name 已提交
39
	return nil, nil
E
eoLinker API Management 已提交
40 41
}

Y
Your Name 已提交
42
//Close close
Y
Your Name 已提交
43
func (d *Discovery) Close() error {
Y
Your Name 已提交
44
	return nil
E
eoLinker API Management 已提交
45 46
}

Y
Your Name 已提交
47
//Open open
Y
Your Name 已提交
48
func (d *Discovery) Open() error {
Y
Your Name 已提交
49
	return nil
E
eoLinker API Management 已提交
50
}