Documentation ¶
Overview ¶
Package serviced NOTES
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GrpcServiceDiscoveryName ¶
GrpcServiceDiscoveryName grpc dial service discovery target name, protocol rule: Scheme:///ServiceDiscoveryName.
func ServiceDiscoveryName ¶
ServiceDiscoveryName return the service's register path in etcd.
Types ¶
type Discover ¶
type Discover interface {
LBRoundRobin() grpc.DialOption
}
Discover defines service discovery related operations.
type DiscoveryOption ¶
DiscoveryOption defines all the service discovery related options.
type HealthInfo ¶
type HealthInfo struct { // Health is state flag, it's string not boolean. Health string `json:"health"` }
HealthInfo is etcd health info, e.g. '{"health":"true"}'.
type Service ¶
type Service interface { State // Register the service Register() error // Deregister the service Deregister() error }
Service defines all the service and discovery related operations.
func NewService ¶
func NewService(cfg etcd3.Config, opt ServiceOption) (Service, error)
NewService create a service instance.
type ServiceDiscover ¶
ServiceDiscover defines all the service and discovery related operations.
func NewServiceD ¶
func NewServiceD(cfg etcd3.Config, opt ServiceOption) (ServiceDiscover, error)
NewServiceD create a service and discovery instance.
type ServiceOption ¶
type ServiceOption struct { Name cc.Name IP string Port uint // Uid is a service's unique identity. Uid string }
ServiceOption defines a service related options.
func (ServiceOption) Validate ¶
func (so ServiceOption) Validate() error
Validate the service option
type State ¶
type State interface { // IsMaster test if this service instance is // master or not. IsMaster() bool // DisableMasterSlave disable/enable this service instance's master-slave check. // if disabled, treat this service as a slave instead of checking if it is master from service discovery. DisableMasterSlave(disable bool) // Healthz etcd health check. Healthz() error }
State defines the service's state related operations.