1 Star 0 Fork 0

zhangjungang/beats

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
util.go 972 Bytes
一键复制 编辑 原始数据 按行查看 历史
package outputs
// Fail helper can be used by output factories, to create a failure response when
// loading an output must return an error.
func Fail(err error) (Group, error) { return Group{}, err }
// Success create a valid output Group response for a set of client instances.
func Success(batchSize, retry int, clients ...Client) (Group, error) {
return Group{
Clients: clients,
BatchSize: batchSize,
Retry: retry,
}, nil
}
// NetworkClients converts a list of NetworkClient instances into []Client.
func NetworkClients(netclients []NetworkClient) []Client {
clients := make([]Client, len(netclients))
for i, n := range netclients {
clients[i] = n
}
return clients
}
func SuccessNet(loadbalance bool, batchSize, retry int, netclients []NetworkClient) (Group, error) {
if !loadbalance {
return Success(batchSize, retry, NewFailoverClient(netclients))
}
clients := NetworkClients(netclients)
return Success(batchSize, retry, clients...)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangjungang/beats.git
git@gitee.com:zhangjungang/beats.git
zhangjungang
beats
beats
v6.2.0

搜索帮助

0d507c66 1850385 C8b1a773 1850385