milvus各组件的结构体分析

milvus各组件的结构体分析

各组件启动,需要构建各组件的结构体,一共8个。

go 复制代码
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端。

go 复制代码
type RootCoord struct {
    // 传递上下文
    ctx context.Context
    // 实现 RoodCoord grpc server
    svr *grpcrootcoord.Server
}
go 复制代码
type Proxy struct {
    // 实现 Proxy grpc server
    svr *grpcproxy.Server
}
go 复制代码
type QueryCoord struct {
    // 传递上下文
    ctx context.Context
    // 实现 QueryCoord grpc server
    svr *grpcquerycoord.Server
}
go 复制代码
type QueryNode struct {
    // 传递上下文
    ctx context.Context
    // 实现 QueryNode grpc server
    svr *grpcquerynode.Server
}
go 复制代码
type DataCoord struct {
    // 传递上下文
    ctx context.Context
    // 实现 DataCoord grpc server
    svr *grpcdatacoord.Server
}
go 复制代码
type DataNode struct {
    // 传递上下文
    ctx context.Context
    // 实现 DataNode grpc server
    svr *grpcdatanode.Server
}

由于IndexCoord和DataCoord合并了,这里结构体为空。

go 复制代码
type IndexCoord struct{}
go 复制代码
type IndexNode struct {
    // 实现 IndexNode grpc server
    svr *grpcindexnode.Server
}

只有Proxy和IndexNode没有ctx。为什么这2个没有ctx??

最原始的ctx为:

go 复制代码
ctx, cancel := context.WithCancel(context.Background())

Server里的ctx为:

go 复制代码
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。

相关推荐
dblens 数据库管理和开发工具1 天前
开源向量数据库比较:Chroma, Milvus, Faiss,Weaviate
数据库·开源·milvus·faiss·chroma·weaviate
玄同7652 天前
数据库全解析:从关系型到向量数据库,LLM 开发中的选型指南
数据库·人工智能·知识图谱·milvus·知识库·向量数据库·rag
自可乐3 天前
Milvus向量数据库/RAG基础设施学习教程
数据库·人工智能·python·milvus
领航猿1号8 天前
Langchain 1.0.2 从入门到精通(含基础、RAG、Milvus、Ollama、MCP、Agents)
langchain·agent·milvus·rag·mcp·langchain 1.0
Knight_AL9 天前
Docker 部署 Milvus 并连接现有 MinIO 对象存储
docker·eureka·milvus
码农阿豪9 天前
基于Milvus与混合检索的云厂商文档智能问答系统:Java SpringBoot全栈实现
java·spring boot·milvus
GeminiJM9 天前
亿级向量检索:Elasticsearch vs. Milvus,性能鸿沟与架构抉择
elasticsearch·架构·milvus
福大大架构师每日一题11 天前
milvus v2.6.9 发布:支持主键搜索、段重开机制、日志性能全面提升!
android·java·milvus
Lkygo14 天前
milvus快速入门(包含图片搜索)
milvus
molaifeng14 天前
告别大模型幻觉:深度解析 RAG 文档切割艺术与 Milvus 高性能实战
milvus·rag