Thread‑safe registry that registers and resolves QueryNode instances by ID within the same process, enabling internal service discovery for tests or single‑node deployments.
// Source: https://github.com/milvus-io/milvus | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package registry
import (
"context"
"sync"
"go.uber.org/atomic"
qnClient "github.com/milvus-io/milvus/internal/distributed/querynode/client"
"github.com/milvus-io/milvus/internal/types"
"github.com/milvus-io/milvus/internal/util/wrappers"
"github.com/milvus-io/milvus/pkg/v3/util/typeutil"
)
var (
once sync.Once
resolver atomic.Pointer[InMemResolver]
)
func GetInMemoryResolver() *InMemResolver {
r := resolver.Load()
if r == nil {
once.Do(func() {
newResolver := &InMemResolver{
queryNodes: typeutil.NewConcurrentMap[int64, types.QueryNode](),
}
resolver.Store
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key