ngrpc

package module
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServerNotFound = errors.New("server not found")
)

Functions

func WithInsecure added in v0.0.20

func WithInsecure() grpc.DialOption

Types

type ClientConn

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

func Dial

func Dial(target string, opts ...grpc.DialOption) *ClientConn

func (*ClientConn) Close

func (this *ClientConn) Close()

func (*ClientConn) Invoke

func (this *ClientConn) Invoke(ctx context.Context, method string, args, reply interface{}, opts ...grpc.CallOption) error

func (*ClientConn) NewStream

func (this *ClientConn) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error)

func (*ClientConn) Prepare

func (this *ClientConn) Prepare()

type ClientPool

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

func NewClientPool

func NewClientPool(size int32, fn DialFun) *ClientPool

func (*ClientPool) Close

func (this *ClientPool) Close()

func (*ClientPool) Get

func (this *ClientPool) Get() (*grpc.ClientConn, error)

func (*ClientPool) Prepare

func (this *ClientPool) Prepare()

type DialFun

type DialFun func() (*grpc.ClientConn, error)

type DialOption

type DialOption struct {
	grpc.EmptyDialOption
	// contains filtered or unexported fields
}

func WithPoolSize

func WithPoolSize(size int32) DialOption

func WithTimeout

func WithTimeout(timeout time.Duration) DialOption
type Header struct {
	// contains filtered or unexported fields
}

func HeaderFromIncoming

func HeaderFromIncoming(ctx context.Context) *Header

func HeaderFromMetadata

func HeaderFromMetadata(md metadata.MD) *Header

func HeaderFromOutgoing

func HeaderFromOutgoing(ctx context.Context) *Header

func NewHeader

func NewHeader() *Header

func (*Header) Context

func (this *Header) Context(ctx context.Context) context.Context

func (*Header) Del

func (this *Header) Del(key string)

func (*Header) ForeachKey

func (this *Header) ForeachKey(handler func(key, val string) error) error

func (*Header) Get

func (this *Header) Get(key string) string

func (*Header) Len

func (this *Header) Len() int

func (*Header) Raw

func (this *Header) Raw() metadata.MD

func (*Header) Set

func (this *Header) Set(key, value string)

type Registry

type Registry interface {
	Scheme() string

	Register(ctx context.Context, domain, service, node, addr string, ttl int64) (key string, err error)

	Unregister(ctx context.Context, domain, service, node string) (err error)

	BuildPath(domain, service, node string) string

	Close()
}

type Server

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

func NewServer

func NewServer(domain, service, node string, registry Registry, opts ...grpc.ServerOption) (*Server, error)

func (*Server) Addr

func (this *Server) Addr() string

func (*Server) Domain

func (this *Server) Domain() string

func (*Server) GracefulStop

func (this *Server) GracefulStop()

func (*Server) Name

func (this *Server) Name() string

func (*Server) Node

func (this *Server) Node() string

func (*Server) RegisterService

func (this *Server) RegisterService(desc *grpc.ServiceDesc, impl interface{})

func (*Server) Registry

func (this *Server) Registry() Registry

func (*Server) Run

func (this *Server) Run() error

func (*Server) Server

func (this *Server) Server() *grpc.Server

func (*Server) Service

func (this *Server) Service() string

func (*Server) Stop

func (this *Server) Stop()

type ServerOption

type ServerOption struct {
	grpc.EmptyServerOption
	// contains filtered or unexported fields
}

func WithAddress

func WithAddress(addr string) ServerOption

func WithRegisterTTL

func WithRegisterTTL(ttl int64) ServerOption

Directories

Path Synopsis
balancer
ketama Module
examples module
interceptor
registry
etcd Module

Jump to

Keyboard shortcuts

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