Documentation
¶
Index ¶
- func NewServiceDiscoveryAndConn(connString, basePath string) (*ServiceDiscovery, Conn, error)
- type Conn
- type FixedSetInstanceProvider
- type InstanceProvider
- type InstanceSerializer
- type JsonInstanceSerializer
- type ProviderStrategy
- type RandomProvider
- type RoundRobinProvider
- type ServiceDiscovery
- func (s *ServiceDiscovery) MaintainRegistrations() error
- func (s *ServiceDiscovery) Provider(name string) ServiceProvider
- func (s *ServiceDiscovery) ProviderWithStrategy(name string, strat ProviderStrategy) ServiceProvider
- func (s *ServiceDiscovery) Register(service *ServiceInstance) error
- func (s *ServiceDiscovery) ReregisterAll() error
- func (s *ServiceDiscovery) StateChanged(c curator.CuratorFramework, n curator.ConnectionState)
- func (s *ServiceDiscovery) Unregister(service *ServiceInstance) error
- func (s *ServiceDiscovery) UnregisterAll() error
- func (s *ServiceDiscovery) Watch() error
- type ServiceDiscoveryInstanceProvider
- type ServiceInstance
- type ServiceProvider
- type ServiceType
- type TreeCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServiceDiscoveryAndConn ¶
func NewServiceDiscoveryAndConn(connString, basePath string) (*ServiceDiscovery, Conn, error)
Types ¶
type FixedSetInstanceProvider ¶
type FixedSetInstanceProvider struct {
// contains filtered or unexported fields
}
func (*FixedSetInstanceProvider) GetAllInstances ¶
func (p *FixedSetInstanceProvider) GetAllInstances() ([]*ServiceInstance, error)
type InstanceProvider ¶
type InstanceProvider interface { /** * Return the current available set of instances <b>IMPORTANT: </b> users * should not hold on to the instance returned. They should always get a fresh list. */ GetAllInstances() ([]*ServiceInstance, error) }
type InstanceSerializer ¶
type InstanceSerializer interface { Serialize(i *ServiceInstance) ([]byte, error) Deserialize(b []byte) (*ServiceInstance, error) }
type JsonInstanceSerializer ¶
type JsonInstanceSerializer struct { }
func (*JsonInstanceSerializer) Deserialize ¶
func (s *JsonInstanceSerializer) Deserialize(b []byte) (*ServiceInstance, error)
func (*JsonInstanceSerializer) Serialize ¶
func (s *JsonInstanceSerializer) Serialize(i *ServiceInstance) ([]byte, error)
type ProviderStrategy ¶
type ProviderStrategy interface { // Given a source of instances, return one of them for a single use. GetInstance(instanceProvider InstanceProvider) (*ServiceInstance, error) }
type RandomProvider ¶
func NewRandomProvider ¶
func NewRandomProvider() *RandomProvider
func (RandomProvider) GetInstance ¶
func (r RandomProvider) GetInstance(ip InstanceProvider) (*ServiceInstance, error)
type RoundRobinProvider ¶
type RoundRobinProvider struct {
// contains filtered or unexported fields
}
func NewRoundRobinProvider ¶
func NewRoundRobinProvider() *RoundRobinProvider
func (*RoundRobinProvider) GetInstance ¶
func (r *RoundRobinProvider) GetInstance(ip InstanceProvider) (*ServiceInstance, error)
type ServiceDiscovery ¶
type ServiceDiscovery struct { // Cache of watched services Services map[string][]*ServiceInstance // contains filtered or unexported fields }
func NewServiceDiscovery ¶
func NewServiceDiscovery(client Conn, basePath string) *ServiceDiscovery
func (*ServiceDiscovery) MaintainRegistrations ¶
func (s *ServiceDiscovery) MaintainRegistrations() error
func (*ServiceDiscovery) Provider ¶
func (s *ServiceDiscovery) Provider(name string) ServiceProvider
func (*ServiceDiscovery) ProviderWithStrategy ¶
func (s *ServiceDiscovery) ProviderWithStrategy(name string, strat ProviderStrategy) ServiceProvider
func (*ServiceDiscovery) Register ¶
func (s *ServiceDiscovery) Register(service *ServiceInstance) error
func (*ServiceDiscovery) ReregisterAll ¶
func (s *ServiceDiscovery) ReregisterAll() error
func (*ServiceDiscovery) StateChanged ¶
func (s *ServiceDiscovery) StateChanged(c curator.CuratorFramework, n curator.ConnectionState)
func (*ServiceDiscovery) Unregister ¶
func (s *ServiceDiscovery) Unregister(service *ServiceInstance) error
func (*ServiceDiscovery) UnregisterAll ¶
func (s *ServiceDiscovery) UnregisterAll() error
func (*ServiceDiscovery) Watch ¶
func (s *ServiceDiscovery) Watch() error
type ServiceDiscoveryInstanceProvider ¶
type ServiceDiscoveryInstanceProvider struct {
// contains filtered or unexported fields
}
func (*ServiceDiscoveryInstanceProvider) GetAllInstances ¶
func (s *ServiceDiscoveryInstanceProvider) GetAllInstances() ([]*ServiceInstance, error)
func (*ServiceDiscoveryInstanceProvider) GetInstance ¶
func (s *ServiceDiscoveryInstanceProvider) GetInstance() (*ServiceInstance, error)
type ServiceInstance ¶
type ServiceInstance struct { Name string `json:"name"` Id string `json:"id"` Address string `json:"address"` Port *int `json:"port"` SslPort *int `json:"sslPort"` Payload *string `json:"payload"` RegistrationTimeUTC int64 `json:"registrationTimeUTC"` ServiceType ServiceType `json:"serviceType"` UriSpec *string `json:"uriSpec"` }
func NewServiceInstance ¶
func NewServiceInstance(name, address string, port, ssl *int, payload *string) *ServiceInstance
func NewSimpleServiceInstance ¶
func NewSimpleServiceInstance(name, address string, port int) *ServiceInstance
func (*ServiceInstance) Spec ¶
func (i *ServiceInstance) Spec() string
type ServiceProvider ¶
type ServiceProvider interface { InstanceProvider /** * Return an instance for a single use. <b>IMPORTANT: </b> users * should not hold on to the instance returned. They should always get a fresh instance. */ GetInstance() (*ServiceInstance, error) }
type ServiceType ¶
type ServiceType string
const ( DYNAMIC ServiceType = "DYNAMIC" STATIC ServiceType = "STATIC" PERMANENT ServiceType = "PERMANENT" )
type TreeCache ¶
type TreeCache struct { *ServiceDiscovery // contains filtered or unexported fields }
func NewTreeCache ¶
func NewTreeCache(s *ServiceDiscovery) *TreeCache
Click to show internal directories.
Click to hide internal directories.