grpc

package
v5.0.0-...-b98a0e9 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EndpointKey = endpointKey{}

Functions

func HandlerStreamInterceptor

func HandlerStreamInterceptor(interceptors *[]grpc.StreamServerInterceptor) grpc.StreamServerInterceptor

func HandlerUnaryInterceptor

func HandlerUnaryInterceptor(interceptors *[]grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor

func New

func New(ctx context.Context, opt ...Option) server.Server

New creates the generic grpc.Server

func NewWithServer

func NewWithServer(ctx context.Context, name string, s *grpc.Server, listen string) server.Server

NewWithServer can pass preset grpc.Server with custom listen address

Types

type Handler

type Handler struct{}

type IServer

type IServer interface {
	RegisterService(sd *grpc.ServiceDesc, ss any)
	GetServiceInfo() map[string]grpc.ServiceInfo
	Serve(lis net.Listener) error
	Stop()
	GracefulStop()
}

type Opener

type Opener struct {
}

func (*Opener) OpenURL

func (o *Opener) OpenURL(ctx context.Context, u *url.URL) (server.Server, error)

type Option

type Option func(*Options)

func WithAddr

func WithAddr(addr string) Option

func WithListener

func WithListener(lis net.Listener) Option

func WithName

func WithName(name string) Option

func WithScheme

func WithScheme(scheme string) Option

type Options

type Options struct {
	Scheme   string
	Name     string
	Addr     string
	Listener net.Listener
}

type Server

type Server struct {
	Server IServer

	sync.Mutex
	// contains filtered or unexported fields
}

func (*Server) As

func (s *Server) As(i interface{}) bool

func (*Server) Clone

func (s *Server) Clone() interface{}

func (*Server) ID

func (s *Server) ID() string

func (*Server) Metadata

func (s *Server) Metadata() map[string]string

func (*Server) Name

func (s *Server) Name() string

func (*Server) RawServe

func (s *Server) RawServe(opts *server.ServeOptions) (ii []registry.Item, e error)

func (*Server) Stop

func (s *Server) Stop() error

func (*Server) Type

func (s *Server) Type() server.Type

Jump to

Keyboard shortcuts

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