2023-03-27 00:42:00 +08:00
|
|
|
package querynodev2
|
|
|
|
|
|
|
|
import (
|
2023-06-09 01:28:37 +08:00
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
2023-03-27 00:42:00 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/util"
|
2023-04-06 19:14:32 +08:00
|
|
|
"github.com/milvus-io/milvus/pkg/util/paramtable"
|
2023-03-27 00:42:00 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func WrapRetrieveResult(code commonpb.ErrorCode, msg string, errs ...error) *internalpb.RetrieveResults {
|
|
|
|
return &internalpb.RetrieveResults{
|
|
|
|
Status: util.WrapStatus(code, msg, errs...),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func WrapSearchResult(code commonpb.ErrorCode, msg string, errs ...error) *internalpb.SearchResults {
|
|
|
|
return &internalpb.SearchResults{
|
|
|
|
Status: util.WrapStatus(code, msg, errs...),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// CheckTargetID checks whether the target ID of request is the server itself,
|
|
|
|
// returns true if matched,
|
|
|
|
// returns false otherwise
|
|
|
|
func CheckTargetID[R interface{ GetBase() *commonpb.MsgBase }](req R) bool {
|
|
|
|
return req.GetBase().GetTargetID() == paramtable.GetNodeID()
|
|
|
|
}
|