dispatcher

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCreateEndpoint = errors.New("cannot create endpoint")
	ErrNoConnections  = errors.New("no alive connections available")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger               logger.Logger
	EndpointsProvider    EndpointsProvider
	Auth                 transport.Authenticator
	TransportCredentials credentials.TransportCredentials
	DB                   string
	InitNodes            []string
	Balancer             balancer.Config
}

type Dynamic added in v0.0.2

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

Dynamic is a dispatcher that provides dynamic transport layer by gluing together endpoints provider and balancer.

It uses provider's announces to populate balancing grid, and acts as grpc transport.

func NewDynamic added in v0.0.2

func NewDynamic(cfg Config) *Dynamic

func (*Dynamic) Run added in v0.0.2

func (d *Dynamic) Run(ctx context.Context, wg *sync.WaitGroup)

func (*Dynamic) Transport added in v0.0.2

func (d *Dynamic) Transport() grpc.ClientConnInterface

type EndpointsProvider

type EndpointsProvider interface {
	EndpointsChan() <-chan endpoints.Announce
}

type Static added in v0.0.2

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

func NewStatic added in v0.0.2

func NewStatic(
	ctx context.Context,
	endpoints []string,
	creds credentials.TransportCredentials,
	auth transport.Authenticator,
	db string,
) (*Static, error)

NewStatic provides transport layer with fixed endpoints.

func (*Static) Transport added in v0.0.2

func (s *Static) Transport() grpc.ClientConnInterface

Jump to

Keyboard shortcuts

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