krpc

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Scheme_Etcd = "etcd"
)

Variables

This section is empty.

Functions

func AddLocal

func AddLocal(local *Local)

func Close

func Close()

func Dial

func Dial(serviceName ServiceName, group string) (grpc.ClientConnInterface, error)

func DialDefault added in v0.0.2

func DialDefault(serviceName ServiceName) (grpc.ClientConnInterface, error)

func SetLoadBalance added in v0.0.2

func SetLoadBalance(name string)

func SetLocals

func SetLocals(locals []*Local)

func SetMode

func SetMode(m Mode)

Types

type LoadBalance added in v0.0.2

type LoadBalance struct {
	Config []map[string]any `json:"loadBalancingConfig"`
}

func NewLoadBalance added in v0.0.2

func NewLoadBalance(name string) LoadBalance

type Local

type Local struct {
	Host    string      `yaml:"host" json:"host"`
	Port    int         `yaml:"port" json:"port"`
	Name    ServiceName `yaml:"name" json:"name"`
	Group   string      `yaml:"group" json:"group"`
	Weight  int64       `yaml:"weight" json:"weight"`
	Version string      `yaml:"version" json:"version"`
}

func (*Local) Addr

func (l *Local) Addr() string

func (*Local) InnerAddr added in v0.0.4

func (l *Local) InnerAddr() string

func (*Local) Instance added in v0.0.3

func (l *Local) Instance() *grpc.Instance

func (*Local) ServiceName

func (l *Local) ServiceName() string

type Locals

type Locals map[string]*Local

func (Locals) Add

func (l Locals) Add(lo *Local)

func (Locals) Get

func (l Locals) Get(name string) (*Local, bool)

type Mode

type Mode string
const (
	Mode_Local  Mode = "local"  // local service
	Mode_Remote Mode = "remote" // remote service
)

type ServiceName

type ServiceName string

func (ServiceName) Default

func (s ServiceName) Default() string

func (ServiceName) Group

func (s ServiceName) Group(group string) string

Jump to

Keyboard shortcuts

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