zrpc

package
v1.10.33 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 20 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WithDialOption             = internal.WithDialOption
	WithTimeout                = internal.WithTimeout
	WithUnaryClientInterceptor = internal.WithUnaryClientInterceptor
)

Functions

This section is empty.

Types

type Client

type Client interface {
	Conn() *grpc.ClientConn
}

func MustNewClient

func MustNewClient(c RpcClientConf, options ...ClientOption) Client

func NewClient

func NewClient(c RpcClientConf, options ...ClientOption) (Client, error)

func NewClientNoAuth

func NewClientNoAuth(c etcdv3.EtcdConf, opts ...ClientOption) (Client, error)

func NewClientWithTarget

func NewClientWithTarget(target string, opts ...ClientOption) (Client, error)

type ClientOption

type ClientOption = internal.ClientOption

type RpcClient

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

func (*RpcClient) Conn

func (rc *RpcClient) Conn() *grpc.ClientConn

type RpcClientConf

type RpcClientConf struct {
	Etcd      etcdv3.EtcdConf   `json:",optional"`
	Consul    consul.ConsulConf `json:",optional"`
	Endpoints []string          `json:",optional"`
	App       string            `json:",optional"`
	Token     string            `json:",optional"`
	Timeout   int64             `json:",optional"`
}

func NewDirectClientConf

func NewDirectClientConf(endpoints []string, app, token string) RpcClientConf

func NewEtcdClientConf

func NewEtcdClientConf(hosts []string, key, app, token string) RpcClientConf

func (RpcClientConf) HasConsul added in v1.10.22

func (cc RpcClientConf) HasConsul() bool

func (RpcClientConf) HasCredential

func (cc RpcClientConf) HasCredential() bool

func (RpcClientConf) HasEtcd added in v1.10.22

func (cc RpcClientConf) HasEtcd() bool

type RpcProxy

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

func NewProxy

func NewProxy(backend string, opts ...internal.ClientOption) *RpcProxy

func (*RpcProxy) TakeConn

func (p *RpcProxy) TakeConn(ctx context.Context) (*grpc.ClientConn, error)

type RpcServer

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

func MustNewServer

func MustNewServer(c RpcServerConf, register internal.RegisterFn) *RpcServer

func NewServer

func NewServer(c RpcServerConf, register internal.RegisterFn) (*RpcServer, error)

func (*RpcServer) AddOptions

func (rs *RpcServer) AddOptions(options ...grpc.ServerOption)

func (*RpcServer) AddStreamInterceptors

func (rs *RpcServer) AddStreamInterceptors(interceptors ...grpc.StreamServerInterceptor)

func (*RpcServer) AddUnaryInterceptors

func (rs *RpcServer) AddUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor)

func (*RpcServer) Start

func (rs *RpcServer) Start()

func (*RpcServer) Stop

func (rs *RpcServer) Stop()

type RpcServerConf

type RpcServerConf struct {
	service.ServiceConf
	ListenOn      string
	Etcd          etcdv3.EtcdConf    `json:",optional"`
	Consul        consul.ConsulConf  `json:",optional"`
	Auth          bool               `json:",optional"`
	Redis         redis.RedisKeyConf `json:",optional"`
	StrictControl bool               `json:",optional"`
	// pending forever is not allowed
	// never set it to 0, if zero, the underlying will set to 2s automatically
	Timeout      int64 `json:",default=2000"`
	CpuThreshold int64 `json:",default=900,range=[0:1000]"`
}

func (RpcServerConf) HasConsul added in v1.10.22

func (sc RpcServerConf) HasConsul() bool

func (RpcServerConf) HasEtcd

func (sc RpcServerConf) HasEtcd() bool

func (RpcServerConf) Validate

func (sc RpcServerConf) Validate() error

Directories

Path Synopsis
mock
Package mock is a generated protocol buffer package.
Package mock is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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