conns

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnNameTypeID = "2d281e77-3133-4718-a5b7-9eea069591ca"
)
View Source
const (
	ConnsTypeID = "7bf0a017-ef0c-496a-b04c-b1dc262abc8d"
)

Variables

This section is empty.

Functions

func ConnNameConfigTypeLive

func ConnNameConfigTypeLive() *dot.ConfigTypeLive

jayce edit return config of ConnName

func ConnNameTypeLives

func ConnNameTypeLives() []*dot.TypeLives

func ConnsConfigTypeLive

func ConnsConfigTypeLive() *dot.ConfigTypeLive

jayce edit return config of Conn

func ConnsTypeLives

func ConnsTypeLives() []*dot.TypeLives

Data structure needed when generating newer component

Types

type ClientContext

type ClientContext struct {
	ClientConn *grpc.ClientConn
	Ctx        context.Context
	Cancel     context.CancelFunc
}

type ConnName

type ConnName struct {
	Conns_ Conns `dot:"?"` //可选组件,优先使用etcd
	// contains filtered or unexported fields
}

func NewTestConnName

func NewTestConnName(conn Conns, name string) *ConnName

func (*ConnName) AfterAllInject

func (c *ConnName) AfterAllInject(l dot.Line)

func (*ConnName) ClientContext

func (c *ConnName) ClientContext() *ClientContext

func (*ConnName) Conn

func (c *ConnName) Conn() *grpc.ClientConn

func (*ConnName) Injected

func (c *ConnName) Injected(dot.Line) error

func (*ConnName) ServerName

func (c *ConnName) ServerName() string

type Conns

type Conns interface {
	//Return default connection, only one connection
	DefaultClientConn() *grpc.ClientConn
	//Return server name corresponding connection
	ClientConn(serviceName string) *grpc.ClientConn
	//Return ClientContext
	ClientContext(serviceName string) *ClientContext
	//return service name
	ServiceName() []string
	//return schemeName,  Scheme is defined at https://github.com/grpc/grpc/blob/master/doc/naming.md
	SchemeName() string
}

grpc connection, support one Scheme, multi services are below, every service can have multi address(ClientConn load balancing)

func NewTestConns

func NewTestConns(conf *ConnsConfig) Conns

type ConnsConfig

type ConnsConfig struct {
	Scheme   string          `json:"scheme"`
	Services []ServiceConfig `json:"services"` //与etcd是并列的关系,如果name相同时,etcd更优先
}

type ServiceConfig

type ServiceConfig struct {
	Name    string          `json:"name"`
	Addrs   []string        `json:"addrs"`
	Tls     utils.TlsConfig `json:"tls"`
	Balance string          `json:"balance"` // round or first, the default value is round
}

Jump to

Keyboard shortcuts

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