1 Star 2 Fork 0

李文建/light-protoactor-go

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
config.go 1.72 KB
一键复制 编辑 原始数据 按行查看 历史
李文建 提交于 2018-04-20 23:07 +08:00 . 减少队列大小,降低内存小号
package remote
import "google.golang.org/grpc"
type RemotingOption func(*remoteConfig)
func defaultRemoteConfig() *remoteConfig {
return &remoteConfig{
dialOptions: []grpc.DialOption{grpc.WithInsecure()},
endpointWriterBatchSize: 1000,
endpointManagerBatchSize: 1000,
endpointWriterQueueSize: 100000,
endpointManagerQueueSize: 100000,
}
}
func WithEndpointWriterBatchSize(batchSize int) RemotingOption {
return func(config *remoteConfig) {
config.endpointWriterBatchSize = batchSize
}
}
func WithEndpointWriterQueueSize(queueSize int) RemotingOption {
return func(config *remoteConfig) {
config.endpointWriterQueueSize = queueSize
}
}
func WithEndpointManagerBatchSize(batchSize int) RemotingOption {
return func(config *remoteConfig) {
config.endpointManagerBatchSize = batchSize
}
}
func WithEndpointManagerQueueSize(queueSize int) RemotingOption {
return func(config *remoteConfig) {
config.endpointManagerQueueSize = queueSize
}
}
func WithDialOptions(options ...grpc.DialOption) RemotingOption {
return func(config *remoteConfig) {
config.dialOptions = options
}
}
func WithServerOptions(options ...grpc.ServerOption) RemotingOption {
return func(config *remoteConfig) {
config.serverOptions = options
}
}
func WithCallOptions(options ...grpc.CallOption) RemotingOption {
return func(config *remoteConfig) {
config.callOptions = options
}
}
type remoteConfig struct {
serverOptions []grpc.ServerOption
callOptions []grpc.CallOption
dialOptions []grpc.DialOption
endpointWriterBatchSize int
endpointWriterQueueSize int
endpointManagerBatchSize int
endpointManagerQueueSize int
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/lwj8507/light-protoactor-go.git
git@gitee.com:lwj8507/light-protoactor-go.git
lwj8507
light-protoactor-go
light-protoactor-go
013e33d7022f

搜索帮助