Documentation ¶
Index ¶
- type PostgresDiscovery
- func (d *PostgresDiscovery) Clone(servicePath string) (client.ServiceDiscovery, error)
- func (d *PostgresDiscovery) Close()
- func (d *PostgresDiscovery) GetServices() []*client.KVPair
- func (d *PostgresDiscovery) RemoveWatcher(ch chan []*client.KVPair)
- func (d *PostgresDiscovery) SetFilter(filter client.ServiceDiscoveryFilter)
- func (d *PostgresDiscovery) WatchService() chan []*client.KVPair
- type PostgresDiscoveryOption
- type ServiceChange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresDiscovery ¶
type PostgresDiscovery struct { // -1 means it always retry to watch until postgres is ok, 0 means no retry. RetriesAfterWatchFailed int // contains filtered or unexported fields }
PostgresDiscovery is a PostgreSQL-based service discovery. It accepts an external connection pool and watches for service updates.
func NewPostgresDiscoveryWithPool ¶
func NewPostgresDiscoveryWithPool(ctx context.Context, serviceAddress, servicePath string, pool *pgxpool.Pool, opt *PostgresDiscoveryOption) (*PostgresDiscovery, error)
NewPostgresDiscoveryWithPool returns a new PostgresDiscovery using an existing pool.
func (*PostgresDiscovery) Clone ¶
func (d *PostgresDiscovery) Clone(servicePath string) (client.ServiceDiscovery, error)
Clone clones this ServiceDiscovery with new servicePath
func (*PostgresDiscovery) Close ¶
func (d *PostgresDiscovery) Close()
Close closes the discovery but not the underlying pool
func (*PostgresDiscovery) GetServices ¶
func (d *PostgresDiscovery) GetServices() []*client.KVPair
GetServices returns the servers
func (*PostgresDiscovery) RemoveWatcher ¶
func (d *PostgresDiscovery) RemoveWatcher(ch chan []*client.KVPair)
func (*PostgresDiscovery) SetFilter ¶
func (d *PostgresDiscovery) SetFilter(filter client.ServiceDiscoveryFilter)
SetFilter sets the filter
func (*PostgresDiscovery) WatchService ¶
func (d *PostgresDiscovery) WatchService() chan []*client.KVPair
WatchService returns a channel to watch for changes
type PostgresDiscoveryOption ¶
type PostgresDiscoveryOption struct { // RetryCount for watch failures. -1 means infinite retries RetryCount int // Filter for filtering services Filter client.ServiceDiscoveryFilter // Table for storing services Table string }
PostgresDiscoveryOption represents options for PostgresDiscovery
Click to show internal directories.
Click to hide internal directories.