discoverer

package
v1.7.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package discoverer

Package discoverer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Start(ctx context.Context) (<-chan error, error)
	GetAddrs(ctx context.Context) []string

	// GetClient returns the grpc.Client for both read and write.
	GetClient() grpc.Client

	// GetReadClient returns the grpc.Client only for read. If there's no readreplica, this returns the grpc.Client for the primary agent.
	// Use this API only for getting client for agent. For other use cases, use GetClient() instead.
	// Internally, this API round robin between c.client and c.readClient with the ratio of
	// agent replicas and read replica agent replicas.
	GetReadClient() grpc.Client
}

func New

func New(opts ...Option) (d Client, err error)

type Option

type Option func(c *client) error

func WithAutoConnect

func WithAutoConnect(flg bool) Option

func WithDiscoverDuration

func WithDiscoverDuration(dur string) Option

func WithDiscovererClient

func WithDiscovererClient(gc grpc.Client) Option

func WithErrGroup

func WithErrGroup(eg errgroup.Group) Option

func WithName

func WithName(name string) Option

func WithNamespace

func WithNamespace(ns string) Option

func WithNodeName

func WithNodeName(nn string) Option

func WithOnConnectFunc

func WithOnConnectFunc(f func(ctx context.Context, c Client, addr string) error) Option

func WithOnDisconnectFunc

func WithOnDisconnectFunc(f func(ctx context.Context, c Client, addr string) error) Option

func WithOnDiscoverFunc

func WithOnDiscoverFunc(f func(ctx context.Context, c Client, addrs []string) error) Option

func WithOptions

func WithOptions(opts ...grpc.Option) Option

func WithPort

func WithPort(port int) Option

func WithReadReplicaClient added in v1.7.11

func WithReadReplicaClient(gc grpc.Client) Option

func WithReadReplicaReplicas added in v1.7.11

func WithReadReplicaReplicas(num uint64) Option

func WithServiceDNSARecord

func WithServiceDNSARecord(a string) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL