feat: add registry dual-map and engine factory for VectorStore#973
Merged
lyingbug merged 1 commit intoTencent:mainfrom Apr 16, 2026
Merged
feat: add registry dual-map and engine factory for VectorStore#973lyingbug merged 1 commit intoTencent:mainfrom
lyingbug merged 1 commit intoTencent:mainfrom
Conversation
- Extend RetrieveEngineRegistry with byStoreID map for DB store engines - Add StoreRegistry interface and EngineFactory function type - Create engine factory with per-driver SDK client construction - Load VectorStore records from DB into registry at startup - Wire Create/Delete to dynamically register/unregister engines - Add comprehensive unit tests for registry and service
3323545 to
1e9e81f
Compare
This was referenced Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Third PR for VectorStore multi-store architecture (Phase 1). Extends the
RetrieveEngineRegistrywith a dual-map (byEngineType+byStoreID) so DB-stored VectorStore records can be loaded into the registry alongside env-configured engines. CRUD operations dynamically register/unregister engines without requiring an app restart.Part of #921
Why
byEngineType(existing) handles env stores viaRETRIEVE_DRIVER— unchanged, 100% backward compatiblebyStoreID(new) enables multiple instances of the same engine type (e.g., two Elasticsearch clusters)StoreRegistryinterface avoids modifying the existingRetrieveEngineRegistryinterface used by 6 services (17 call sites)EngineFactoryfunction type breaks circular import betweencontainerandservicepackages via DIChanges
Interfaces (
internal/types/interfaces/vectorstore.go)StoreRegistryinterface (RegisterWithStoreID,GetByStoreID,UnregisterByStoreID)EngineFactoryfunction type for DI-injected engine creationRegistry (
internal/application/service/retriever/registry.go)repositories→byEngineType, addbyStoreIDmapStoreRegistrymethods with upsert semantics and idempotent unregisterbyEngineTypeEngine Factory (
internal/container/engine_factory.go)ConnectionConfig: Postgres, SQLite, Elasticsearch (v7/v8 auto-select), Qdrant, Milvus, WeaviateConnectionConfig.VersionContainer (
internal/container/container.go)loadDBStoresIntoRegistry: loads VectorStore records from DB at startup (non-fatal on per-store failure)StoreRegistryandEngineFactoryService (
internal/application/service/vectorstore.go)CreateStore: registers engine in registry after DB persist (best-effort, self-healing on restart)DeleteStore: unregisters engine from registry after DB deleteCore
Key files to review:
internal/application/service/retriever/registry.go— dual-map implementationinternal/container/engine_factory.go— per-driver factory functionsinternal/application/service/vectorstore.go— dynamic registry updatesTest Plan
go test -race)Notes
GetByStoreIDpath.engine_factory_test.goomitted due to protobuf namespace conflict between Milvus and Qdrant SDKs in thecontainerpackage — covered by E2E tests.UnregisterByStoreID— known Phase 1 limitation, tracked for Phase 2Close()interface addition.Related