relay

package
v0.25.3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultNumWorkers = 10

	QueueFlushInterval = 10 * time.Second
	DefaultBatchSize   = 100 // number of messages to batch

	MaxGRPCRetries = 5

	// Maximum message size for GRPC client in bytes
	MaxGRPCMessageSize = 1024 * 1024 * 100 // 100MB
	GRPCRetrySleep     = time.Second * 5
)

Variables

This section is empty.

Functions

func NewConnection

func NewConnection(address, token string, timeout time.Duration, disableTLS, noCtx bool) (*grpc.ClientConn, context.Context, error)

func TestConnection

func TestConnection(cfg *Config) error

Types

type Config

type Config struct {
	Token       string
	GRPCAddress string
	NumWorkers  int
	BatchSize   int
	RelayCh     chan interface{}
	DisableTLS  bool
	Timeout     time.Duration // general grpc timeout (used for all grpc calls)
	Type        string
}

type Relay

type Relay struct {
	Config *Config
	// contains filtered or unexported fields
}

func New

func New(relayCfg *Config) (*Relay, error)

func (*Relay) CallWithRetry added in v0.16.0

func (r *Relay) CallWithRetry(ctx context.Context, method string, publish func(ctx context.Context) error) error

CallWithRetry will retry a GRPC call until it succeeds or reaches a maximum number of retries defined by MaxGRPCRetries

func (*Relay) Run

func (r *Relay) Run(id int, conn *grpc.ClientConn, ctx context.Context)

func (*Relay) StartWorkers

func (r *Relay) StartWorkers() error

Jump to

Keyboard shortcuts

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