brpc

package module
v0.0.0-...-74a5474 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

brpc-go

The Go version implementation of brpc baidu_std protocol, including client side and server side.

Note that this is not an official implementation, and only implements the protocol part. Load balancing, service discovery and other functions are not included. It may be supported in the future

Status

Beta version, the api may be break.

Usage

see examples

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProtocolNotFound = errors.New("protocol not found")
)

Functions

func Dial

func Dial(protocol, target string, options ...DialOption) (grpc.ClientConnInterface, error)

Dial creates a client connection to the given target according to the protocol.

func RegisterProtocol

func RegisterProtocol(name string, p Protocol)

RegisterProtocol registers a protocol.

Types

type BServerOption

type BServerOption func(*ServerOptions)

type CallOption

type CallOption interface{}

CallOption configures how we call the server.

type DialOption

type DialOption interface{}

DialOption configures how we set up the connection.

type Protocol

type Protocol interface {
	Dial(target string, options ...DialOption) (grpc.ClientConnInterface, error)
	NewServer(options ...ServerOption) Server
}

Protocol defines how to make rpc call and serve rpc call.

type Server

type Server interface {
	RegisterService(sd *grpc.ServiceDesc, ss interface{})
	Serve(l net.Listener) error
}

Server is the interface that must be implemented by a protocol server.

func NewServer

func NewServer(protocol string, options ...ServerOption) Server

NewServer creates a new server according to the protocol.

type ServerOption

type ServerOption interface{}

ServerOption configures how we set up the server.

func WithInterceptor

func WithInterceptor(interceptor grpc.UnaryServerInterceptor) ServerOption

type ServerOptions

type ServerOptions struct {
	Interceptor grpc.UnaryServerInterceptor
}

Directories

Path Synopsis
examples
protocol
mux

Jump to

Keyboard shortcuts

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