service

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ServiceName  string `validate:"required"`
	RegistryName string
	Type         uint8  `validate:"required,oneof=1 2"`
	Host         string `validate:"required"`
	Port         int    `validate:"required"`
	Selector     string `validate:"required,oneof=wr"` // TODO support others
	CaCrt        string
	ClientPem    string
	ClientKey    string
}

type Option

type Option func(*Service)

func WithDiscovery

func WithDiscovery(discovery registry.Discovery) Option

func WithSelector added in v1.0.2

func WithSelector(selector selector.Selector) Option

type Service

type Service struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewService

func NewService(config *Config, opts ...Option) (*Service, error)

func (*Service) All added in v1.0.3

func (s *Service) All(ctx context.Context) (node []servicer.Node, err error)

func (*Service) Done

func (s *Service) Done(ctx context.Context, node servicer.Node, err error) error

func (*Service) GetCaCrt

func (s *Service) GetCaCrt() []byte

func (*Service) GetClientKey

func (s *Service) GetClientKey() []byte

func (*Service) GetClientPem

func (s *Service) GetClientPem() []byte

func (*Service) Name

func (s *Service) Name() string

func (*Service) Pick

func (s *Service) Pick(ctx context.Context) (node servicer.Node, err error)

func (*Service) RegistryName

func (s *Service) RegistryName() string

Jump to

Keyboard shortcuts

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