Documentation
¶
Overview ¶
pkg/discovery/consul_discovery.go
Index ¶
- type ConsulClient
- func (c *ConsulClient) DeregisterService(id string) error
- func (c *ConsulClient) GetKV(key string) ([]byte, error)
- func (c *ConsulClient) PutKV(key string, value []byte) error
- func (c *ConsulClient) RegisterService(id, name, address string, port int, tags []string) error
- func (c *ConsulClient) WatchKey(ctx context.Context, key string, waitIndex uint64) ([]byte, uint64, error)
- type Discovery
- type ServiceRegistration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsulClient ¶
type ConsulClient struct {
// contains filtered or unexported fields
}
func NewConsulClient ¶
func NewConsulClient(addr string) (*ConsulClient, error)
func (*ConsulClient) DeregisterService ¶
func (c *ConsulClient) DeregisterService(id string) error
func (*ConsulClient) GetKV ¶
func (c *ConsulClient) GetKV(key string) ([]byte, error)
GetKV 从 Consul KV 读取数据
func (*ConsulClient) PutKV ¶
func (c *ConsulClient) PutKV(key string, value []byte) error
PutKV 将数据写入 Consul KV,key 如 config/app.yaml
func (*ConsulClient) RegisterService ¶
func (c *ConsulClient) RegisterService(id, name, address string, port int, tags []string) error
type Discovery ¶
type Discovery interface {
// GetGRPCConn 获取指定服务的 gRPC 连接
GetGRPCConn(serviceName string) (*grpc.ClientConn, error)
}
func NewConsulDiscovery ¶
Click to show internal directories.
Click to hide internal directories.