Ai
1 Star 0 Fork 0

李文建/protoactor-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
config.go 1.93 KB
一键复制 编辑 原始数据 按行查看 历史
Laurent Meunier 提交于 2019-06-22 01:04 +08:00 . formatting
package remote
import "google.golang.org/grpc"
// RemotingOption configures how the remote infrastructure is started
type RemotingOption func(*remoteConfig)
func defaultRemoteConfig() *remoteConfig {
return &remoteConfig{
advertisedAddress: "",
dialOptions: []grpc.DialOption{grpc.WithInsecure()},
endpointWriterBatchSize: 1000,
endpointManagerBatchSize: 1000,
endpointWriterQueueSize: 1000000,
endpointManagerQueueSize: 1000000,
}
}
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
}
}
func WithAdvertisedAddress(address string) RemotingOption {
return func(config *remoteConfig) {
config.advertisedAddress = address
}
}
type remoteConfig struct {
advertisedAddress string
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/protoactor-go.git
git@gitee.com:lwj8507/protoactor-go.git
lwj8507
protoactor-go
protoactor-go
v0.0.1

搜索帮助