discov

package module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 11 Imported by: 0

README

Discov

中文文档

Discov is a generic gRPC service registration and discovery / load balancing component.

Supported Scenarios

  • The scenario of etcd as the service registry.
  • The scenario of using headless service as DNS name to discover services in Kubernetes cluster.
  • The scenario of DNS as a service registry.

Architecture

architecture

Examples

Documentation

pkg.go.dev

License

MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBuilder

func NewBuilder(opts ...BuilderOption) *builder

Types

type BuilderOption

type BuilderOption struct {
	// contains filtered or unexported fields
}

func WithDNSPollingInterval

func WithDNSPollingInterval(d time.Duration) BuilderOption

func WithEtcdClient

func WithEtcdClient(cli *clientv3.Client) BuilderOption

type EtcdSrvRecord

type EtcdSrvRecord interface {
	// Register registers the record to etcd.
	// This method should be called when the service starts.
	Register()
	// Unregister unregisters the record from etcd.
	// This method should be called when the service is closed.
	Unregister(context.Context) error
	// CatchRuntimeErrors catches runtime errors.
	// Since the EtcdSrvRecord spawns goroutines to keep heartbeat
	// to etcd after calling Register, some errors may occur at runtime.
	CatchRuntimeErrors() <-chan error
}

EtcdSrvRecord is a service record to be registered to or unregistered from etcd.

func NewEtcdSrvRecord

func NewEtcdSrvRecord(cli *clientv3.Client, srvName, srvAddr string) (EtcdSrvRecord, error)

NewEtcdSrvRecord construct a service record.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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