代码拉取完成,页面将自动刷新
package thrift
import (
"fmt"
"gitee.com/h79/goutils/common/logger"
"gitee.com/h79/goutils/discovery/resolver/builder"
thriftresolver "gitee.com/h79/goutils/thrift/resolver"
)
// priBuilder 为thrift桥接
type priBuilder struct {
myBuilder builder.Builder
}
func Register(builder builder.Builder) {
b := &priBuilder{
myBuilder: builder,
}
// 注册到thrift中
thriftresolver.Register(b)
}
// Build grpc interface
func (cb *priBuilder) Build(target thriftresolver.Target, cc thriftresolver.Connector) (thriftresolver.Resolver, error) {
if cc == nil {
return nil, fmt.Errorf("[Thrift Build] client connect is nil")
}
logger.Debug("Thrift: Build target= %+v", target)
tar := builder.Target{
Scheme: target.Scheme,
Authority: target.Authority,
Endpoint: target.Endpoint,
}
cr := &connector{
cc: cc,
}
rr, err := cb.myBuilder.Build(tar, cr)
if err != nil {
return nil, err
}
rr0 := &priResolver{
myResolver: rr,
}
return rr0, nil
}
// Scheme thrift interface
func (cb *priBuilder) Scheme() string {
return cb.myBuilder.Scheme()
}
type priResolver struct {
myResolver builder.Resolver
}
// ResolveNow thrift.Resolver interface
func (cr *priResolver) ResolveNow() {
cr.myResolver.ResolveNow()
}
// Close thrift.Resolver interface
func (cr *priResolver) Close() {
cr.myResolver.Close()
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。