Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GeeRegistryDiscovery ¶
type GeeRegistryDiscovery struct { *MultiServersDiscovery // inherit // contains filtered or unexported fields }
func NewGeeRegistryDiscovery ¶
func NewGeeRegistryDiscovery(registryAddr string, timeout time.Duration) *GeeRegistryDiscovery
because of GeeRegistryDiscovery , xclient don't need know the server the GeeRegistryDiscovery will send http Get method to Registry server and refresh alive servers
func (*GeeRegistryDiscovery) Get ¶
func (d *GeeRegistryDiscovery) Get(mode SelectMode) (string, error)
the registry must refresh first and make sure the server is all alive the server is in MultiServersDiscovery.Servers[] so the final get method is on MultiServersDiscovery
func (*GeeRegistryDiscovery) GetAll ¶
func (d *GeeRegistryDiscovery) GetAll() ([]string, error)
func (*GeeRegistryDiscovery) Refresh ¶
func (d *GeeRegistryDiscovery) Refresh() error
func (*GeeRegistryDiscovery) Update ¶
func (d *GeeRegistryDiscovery) Update(servers []string) error
type MultiServersDiscovery ¶
type MultiServersDiscovery struct {
// contains filtered or unexported fields
}
MultiServersDiscovery is a discovery for multi servers without a registry center user provides the server addresses explicitly instead
func NewMultiServerDiscovery ¶
func NewMultiServerDiscovery(servers []string) *MultiServersDiscovery
NewMultiServerDiscovery creates a MultiServersDiscovery instance
func (*MultiServersDiscovery) Get ¶
func (d *MultiServersDiscovery) Get(mode SelectMode) (string, error)
get a server according to mode
func (*MultiServersDiscovery) GetAll ¶
func (d *MultiServersDiscovery) GetAll() ([]string, error)
func (*MultiServersDiscovery) Refresh ¶
func (d *MultiServersDiscovery) Refresh() error
no sense for MultiServersDiscovery
func (*MultiServersDiscovery) Update ¶
func (d *MultiServersDiscovery) Update(servers []string) error
Update the servers of discovery dynamically if needed
type SelectMode ¶
type SelectMode int
const ( RandomSelect SelectMode = iota RoundRobinSelect )
select Mode random and roundrobin