Categorygithub.com/baidu-golang/pbrpc
modulepackage
1.4.0
Repository: https://github.com/baidu-golang/pbrpc.git
Documentation: pkg.go.dev

# README

baidurpc

baidurpc是一种基于TCP协议的二进制高性能RPC通信协议实现。它以Protobuf作为基本的数据交换格式。 本版本基于golang实现.完全兼容jprotobuf-rpc-socket: https://github.com/Baidu-ecom/Jprotobuf-rpc-socket

Go Report Card Go codecov Releases Go Reference LICENSE

features:

  • 内置连接池,具备更高的性能,低延迟 QPS: 5w+
  • 支持自动重连功能[Done]
  • 支持附件发送[Done]
  • 支持超时功能[Done]
  • 压缩功能,支持GZip与Snappy[Done]
  • 集成内置HTTP管理功能[TODO]
  • Client支持Ha的负载均衡功能[Done]
  • 灵活的超时设置功能[Done] 基于timewheel实现
  • 分包chunk支持,针对大数据包支持拆分包的发送的功能[Done]
  • 支持Web管理能力以及内置能力[Done] 查看
  • 支持同步发布为Http JSON协议[Done] [>= v1.2.0] ​

Installing

To start using pbrpc, install Go and run go get:

$ go get github.com/baidu-golang/pbrpc

Which version

versionprotobuf package
<= 1.2.xgithub.com/golang/protobuf
1.3.xgoogle.golang.org/protobuf

FYI: 由于这两个pb类库并不是完全兼容,官方推荐使用 google.golang.org/protobuf

使用说明与Demo

Quick Start(服务发布)
Quick Start(客户端调用)
同步发布http rpc服务
更多特性使用说明
Demo开发示例代码

License

brpc is Apache 2.0 licensed.

# Packages

No description provided by the author
Go support for Protocol Buffers RPC which compatiable with https://github.com/Baidu-ecom/Jprotobuf-rpc-socket Copyright 2002-2007 the original author or authors.

# Functions

Attachment utility function to get attachemnt from context.
BindAttachement add attachement value to the context.
BindError add error value to the context.
BindError add error value to the context.
CloseBatchConnection close batch connections.
EmptyHead return a empty head with default value.
Error logs to the ERROR, WARNING, and INFO logs.
Errorf logs to the ERROR, WARNING, and INFO logs.
BindError add error value to the context.
No description provided by the author
GUNZIP do unzip action by gzip package.
GZIP do gzip action by gzip package.
Info logs to the INFO log.
Infof logs to the INFO log.
No description provided by the author
NewBatchTCPConnection to create batch connection.
No description provided by the author
NewHaRpcCient.
NewHaRpcCient.
NewRpcCient new rpc client.
NewRpcCientWithTimeWheelSetting new rpc client with set timewheel settings.
No description provided by the author
NewRpcDataPackageProtocol create a RpcDataPackageProtocol and start timewheel.
NewRpcInvocation create RpcInvocation with service name and method name.
NewRPCRequestStatus.
Create a new TCPConnection and try to connect to target server by URL.
No description provided by the author
NewTpcServer.
get time took in seconds.
UnescapeUnicode.
Warning logs to the WARNING and INFO logs.
Warningf logs to the WARNING and INFO logs.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
log id key.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
.
Json value.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
* 验证错误.
* 未知异常.
No description provided by the author
* 方法未找到异常.
* success status.
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

error log info definition.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
error log info definition.
error log info definition.
No description provided by the author
No description provided by the author
error log info definition.
error log info definition.
error log info definition.
error log info definition.
error log info definition.
error log info definition.
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
DefaultService default implemention for Service interface.
ErrorContext.
HaRpcClient high avialbe RpcClient.
RPC header content.
No description provided by the author
HttpStatusView.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ResponseData.
RPC client invoke */.
Data package for baidu RPC.
Codec implements for RpcDataPackage.
Protocol codec factory object for RpcDataPackage.
RpcInvocation define rpc invocation.
No description provided by the author
No description provided by the author
RPCMethodReuqestStatus.
No description provided by the author
RPCRequestStatus.
RpcResult Rpc response result from client request api under asynchronous way.
No description provided by the author
No description provided by the author
TCPConnection simple tcp based connection implementation.
No description provided by the author
TcpServer RPC server base on tcp transport.
No description provided by the author
URL with host and port attribute.

# Interfaces

AuthService authenticate service.
Connection handler interface */.
No description provided by the author
Readable is the interface that deserialize from []byte if errror ocurres should return non-nil error.
No description provided by the author
Service rpc service.
TraceService to monitor trace info and return trace info back.
Writable is the interface that do serialize to []byte if errror ocurres should return non-nil error.

# Type aliases

No description provided by the author