各组件启动,需要构建各组件的结构体,一共8个。
runComponent(ctx, localMsg, wg, components.NewRootCoord, metrics.RegisterRootCoord)
runComponent(ctx, localMsg, wg, components.NewProxy, metrics.RegisterProxy)
runComponent(ctx, localMsg, wg, components.NewQueryCoord, metrics.RegisterQueryCoord)
runComponent(ctx, localMsg, wg, components.NewQueryNode, metrics.RegisterQueryNode)
runComponent(ctx, localMsg, wg, components.NewDataCoord, metrics.RegisterDataCoord)
runComponent(ctx, localMsg, wg, components.NewDataNode, metrics.RegisterDataNode)
runComponent(ctx, localMsg, wg, components.NewIndexCoord, func(registry *prometheus.Registry)
runComponent(ctx, localMsg, wg, components.NewIndexNode, metrics.RegisterIndexNode)
真正的组件功能API都在Server端。
type RootCoord struct {
// 传递上下文
ctx context.Context
// 实现 RoodCoord grpc server
svr *grpcrootcoord.Server
}
type Proxy struct {
// 实现 Proxy grpc server
svr *grpcproxy.Server
}
type QueryCoord struct {
// 传递上下文
ctx context.Context
// 实现 QueryCoord grpc server
svr *grpcquerycoord.Server
}
type QueryNode struct {
// 传递上下文
ctx context.Context
// 实现 QueryNode grpc server
svr *grpcquerynode.Server
}
type DataCoord struct {
// 传递上下文
ctx context.Context
// 实现 DataCoord grpc server
svr *grpcdatacoord.Server
}
type DataNode struct {
// 传递上下文
ctx context.Context
// 实现 DataNode grpc server
svr *grpcdatanode.Server
}
由于IndexCoord和DataCoord合并了,这里结构体为空。
type IndexCoord struct{}
type IndexNode struct {
// 实现 IndexNode grpc server
svr *grpcindexnode.Server
}
只有Proxy和IndexNode没有ctx。为什么这2个没有ctx??
最原始的ctx为:
ctx, cancel := context.WithCancel(context.Background())
Server里的ctx为:
ctx1, cancel := context.WithCancel(ctx)
服务端路径:
internal\distributed\rootcoord\service.go
internal\distributed\proxy\service.go
internal\distributed\querycoord\service.go
internal\distributed\querynode\service.go
internal\distributed\datacoord\service.go
internal\distributed\datanode\service.go
internal\distributed\indexnode\service.go
每个服务端都有自己的API。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。