invoker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxTries represents the max count for retry
	MaxTries = 8
	// MaxTimeout represents the timeout seconds
	MaxTimeout = 8 * time.Second
	// MaxDelay represents the delay seconds
	MaxDelay = 8 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Delay

type Delay interface {
	GetDelay() time.Duration
}

Delay defin a interface that has a method: GetDelay returns delay seconds

func NewDelay

func NewDelay(delay time.Duration) Delay

NewDelay returns a commonDelay

func NewFibDelay

func NewFibDelay(delay time.Duration) Delay

NewFibDelay return a fibDelay

type FailfastInvoker

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

FailfastInvoker will be returned immediately when invoking timeout

type FailoverInvoker

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

FailoverInvoker can be retry when invoke failed

func (*FailoverInvoker) Invoke

func (f *FailoverInvoker) Invoke(ctx context.Context, conn *grpc.ClientConn, method string, request, response interface{}, opts ...grpc.CallOption) error

Invoke method invoke grpc.Invoke that can be retry when invoke failed

type FailsafeInvoker

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

FailsafeInvoker will be returned immediately when invoking timeout or failed

type Invoker

type Invoker interface {
	Invoke(ctx context.Context, conn *grpc.ClientConn, method string, request, response interface{}, opts ...grpc.CallOption) error
}

Invoker has a method Invoke used to invoke grpc.Invoke

func NewFailoverInvoker

func NewFailoverInvoker(tries int, timeout time.Duration, delay Delay) Invoker

NewFailoverInvoker returns an Invoker

Jump to

Keyboard shortcuts

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