grpc

package
v5.0.0-...-ad4f444 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: AGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const BalancerRoundRobin = "cells-robin-"

Variables

View Source
var (
	CallTimeoutShort = 1 * time.Second
)

Functions

func NewBuilder

func NewBuilder(reg registry.Registry, oo ...client.BalancerOption) resolver.Builder

func RegisterMock

func RegisterMock(serviceName string, mock grpc.ClientConnInterface)

RegisterMock registers a stubbed ClientConnInterface for a given service

func RegisterServiceTransformer

func RegisterServiceTransformer(transformer ServiceTransformer)

func ResolveConn

func ResolveConn(ctx context.Context, serviceName string, opt ...Option) grpc.ClientConnInterface

Types

type HealthMonitor

type HealthMonitor interface {
	Monitor(string)
	Up() bool
	Stop()
}

HealthMonitor blocks a connection to a specific service health

func NewHealthChecker

func NewHealthChecker(c context.Context) HealthMonitor

NewHealthChecker creates a HealthMonitor that blocks once on establishing the gRPC connection

func NewHealthCheckerWithRetries

func NewHealthCheckerWithRetries(c context.Context, retry, timeout time.Duration) HealthMonitor

NewHealthCheckerWithRetries creates a HealthMonitor that retries the gRPC connection if it fails Do not pass 0 as retry or timeout parameters !

type Option

type Option func(*Options)

func WithCallTimeout

func WithCallTimeout(c time.Duration) Option

func WithClientConn

func WithClientConn(c grpc.ClientConnInterface) Option

func WithDialOptions

func WithDialOptions(opts ...grpc.DialOption) Option

func WithPeerSelector

func WithPeerSelector(host string) Option

func WithRegistry

func WithRegistry(r registry.Registry) Option

func WithSilentNotFound

func WithSilentNotFound() Option

type Options

type Options struct {
	ClientConn     grpc.ClientConnInterface
	Registry       registry.Registry
	CallTimeout    time.Duration
	DialOptions    []grpc.DialOption
	BalancerFilter client.BalancerTargetFilter
	SilentNotFound bool
}

type ServiceTransformer

type ServiceTransformer func(context.Context, string) (string, []string, bool)

Jump to

Keyboard shortcuts

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