kitutil

package
v0.0.0-...-b729584 Latest Latest
Warning

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

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

README

Util for go-kit

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceStrategy

type BalanceStrategy string
const (
	RandomBalance     BalanceStrategy = "random"
	RoundRobinBalance BalanceStrategy = "rr"
)

type ClientEndpointConf

type ClientEndpointConf struct {
	Node    *NodeContext
	Factory sd.Factory

	InstancerDisabled bool
	InstancerService  string
	InstancerTags     []string
	// Health only
	InstancerPassingOnly bool

	EndpointerOptions []sd.EndpointerOption

	BalancerStrategy   BalanceStrategy
	RandomBalancerSeed int64

	RetryMax      int
	RetryTimeout  time.Duration
	RetryCallback lb.Callback
}

type ClientEndpointContext

type ClientEndpointContext struct {
	Endpoint   endpoint.Endpoint
	Endpointer sd.Endpointer
	Instancer  sd.Instancer
	Balancer   lb.Balancer

	ConsulInstancer *consulsd.Instancer
}

func MakeClientEndpointContext

func MakeClientEndpointContext(conf ClientEndpointConf) (*ClientEndpointContext, error)

type Logger

type Logger interface {
	Log(keyvals ...interface{}) error
	Debug(keyvals ...interface{})
	Info(keyvals ...interface{})
	Warn(keyvals ...interface{})
	Error(keyvals ...interface{})
	With(keyvals ...interface{}) Logger
	WithPrefix(keyvals ...interface{}) Logger
}

func NewLogger

func NewLogger(logger kitlog.Logger) Logger

type NodeConf

type NodeConf struct {
	Logger     log.Logger
	Consul     bool
	ConsulConf *consulapi.Config
}

type NodeContext

type NodeContext struct {
	Logger       log.Logger
	ConsulClient *consulapi.Client

	ConsulSdClient consulsd.Client
}

func MakeNodeContext

func MakeNodeContext(conf NodeConf) (*NodeContext, error)

func MustMakeNodeContext

func MustMakeNodeContext(conf NodeConf) *NodeContext

type ServiceEndpointConf

type ServiceEndpointConf struct {
	Node *NodeContext

	ConsulService *consulapi.AgentServiceRegistration
}

type ServiceEndpointContext

type ServiceEndpointContext struct {
	Registrar sd.Registrar
}

func MakeServiceEndpointContext

func MakeServiceEndpointContext(conf ServiceEndpointConf) (*ServiceEndpointContext, error)

Jump to

Keyboard shortcuts

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