Documentation ¶
Index ¶
Constants ¶
View Source
const ( ServiceURLAdd = iota ServiceURLDel ServiceURLUpdate )
View Source
const (
REGISTRY_CONN_DELAY = 3 // watchDir中使用,防止不断地对zk重连
)
Variables ¶
View Source
var (
ErrorRegistryNotFound = errors.New("registry not found")
)
Functions ¶
This section is empty.
Types ¶
type NewRegistry ¶ added in v0.2.0
type Option ¶
type Option func(*Options)
Option used to initialise the client
func ApplicationConf ¶
func ApplicationConf(conf common.ApplicationConfig) Option
func RegistryConf ¶
func RegistryConf(conf RegistryConfig) Option
type Options ¶
type Options struct { common.ApplicationConfig RegistryConfig // Other options for implementations of the interface // can be stored in a context Context context.Context }
type ProviderServiceConfig ¶
type ProviderServiceConfig struct { ServiceConfig Path string Methods string }
func (ProviderServiceConfig) ServiceEqual ¶
func (c ProviderServiceConfig) ServiceEqual(url *ServiceURL) bool
func (ProviderServiceConfig) String ¶
func (c ProviderServiceConfig) String() string
type Registry ¶
type Registry interface { // Register(conf ServiceConfig) error Register(conf interface{}) error GetServices(ServiceConfigIf) ([]*ServiceURL, error) Watch() (Watcher, error) Close() String() string }
The registry provides an interface for service discovery and an abstraction over varying implementations {etcd, zookeeper, ...}
type RegistryConfig ¶
type Result ¶
type Result = ServiceURLEvent
Result is returned by a call to Next on the watcher. Actions can be create, update, delete
type ServerConfig ¶
type ServerConfig struct { Protocol string `required:"true",default:"dubbo"` // codec string, jsonrpc etc IP string Port int `required:"true"` }
func (*ServerConfig) Address ¶
func (c *ServerConfig) Address() string
type ServiceConfig ¶
type ServiceConfig struct { Protocol string `required:"true",default:"dubbo"` // codec string, jsonrpc etc Service string `required:"true"` // 其本质是dubbo.xml中的interface Group string Version string }
func (c *consumerZookeeperRegistry) Register(conf ServiceConfig) 函数用到了Service
func (ServiceConfig) Key ¶ added in v0.2.0
func (c ServiceConfig) Key() string
func (ServiceConfig) ServiceEqual ¶
func (c ServiceConfig) ServiceEqual(url *ServiceURL) bool
目前不支持一个service的多个协议的使用,将来如果要支持,关键点就是修改这个函数
func (ServiceConfig) String ¶
func (c ServiceConfig) String() string
type ServiceConfigIf ¶
type ServiceConfigIf interface { String() string ServiceEqual(url *ServiceURL) bool }
type ServiceURL ¶
type ServiceURL struct { Protocol string Location string // ip+port Path string // like /com.ikurento.dubbo.UserProvider3 Ip string Port string Version string Group string Query url.Values Weight int32 PrimitiveURL string }
func NewServiceURL ¶
func NewServiceURL(urlString string) (*ServiceURL, error)
func (*ServiceURL) CheckMethod ¶
func (s *ServiceURL) CheckMethod(method string) bool
func (*ServiceURL) ServiceConfig ¶ added in v0.2.0
func (s *ServiceURL) ServiceConfig() ServiceConfig
func (ServiceURL) String ¶ added in v0.2.0
func (s ServiceURL) String() string
type ServiceURLEvent ¶
type ServiceURLEvent struct { Action ServiceURLEventType Service *ServiceURL }
func (ServiceURLEvent) String ¶
func (e ServiceURLEvent) String() string
type ServiceURLEventType ¶
type ServiceURLEventType int
func (ServiceURLEventType) String ¶
func (t ServiceURLEventType) String() string
Click to show internal directories.
Click to hide internal directories.