servicer

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeRegistry uint8 = 1
	TypeIPPort   uint8 = 2
	TypeDomain   uint8 = 3
)

Variables

This section is empty.

Functions

func DelServicer

func DelServicer(s Servicer)

func Empty added in v1.0.2

func Empty() *node

func ExtractAddress added in v1.0.2

func ExtractAddress(address string) (string, int)

func GenerateAddress added in v1.0.2

func GenerateAddress(host string, port int) string

func NewNode added in v1.0.2

func NewNode(host string, port int, opts ...Option) *node

func SetServicer

func SetServicer(s Servicer) (err error)

func UpdateServicer added in v1.0.5

func UpdateServicer(s Servicer)

Types

type Node

type Node interface {
	Address() string
	Host() string
	Port() int
	Weight() int
	FloatWeight() float64
	Statistics() Statistics
	IncrSuccess()
	IncrFail()
}

type Option added in v1.0.2

type Option func(*node)

func WithFloatWeight added in v1.0.2

func WithFloatWeight(w float64) Option

func WithWeight added in v1.0.2

func WithWeight(w int) Option

type Servicer

type Servicer interface {
	Name() string
	RegistryName() string
	Pick(ctx context.Context) (Node, error)
	All(ctx context.Context) ([]Node, error)
	Done(ctx context.Context, node Node, err error) error
	GetCaCrt() []byte
	GetClientPem() []byte
	GetClientKey() []byte
}

func GetServicer

func GetServicer(serviceName string) (Servicer, bool)

type Statistics added in v1.0.2

type Statistics struct {
	Success uint64
	Fail    uint64
}

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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