borinquenkid opened a new pull request, #15780:
URL: https://github.com/apache/grails-core/pull/15780

   ## Summary
   
   Introduces the `GormRegistry` singleton that replaces the O(M×N) static map 
allocation in `GormEnhancer`. APIs are registered once at entity-registration 
time and looked up in O(1).
   
   - **`GormRegistry`** — singleton keyed by `(entityClass, qualifier)`; 
handles `MultiTenant` qualifier expansion, thread-local preferred datastore, 
and concurrent-safe removal on `close()`
   - **`GormApiFactory` / `DefaultGormApiFactory`** — pluggable factory per 
datastore type; adapters override this to supply typed API instances
   - **`GormApiResolver`** — routes static/instance/validation API lookups 
through the registry with fallback to the default datastore
   - **`ConnectionSourceNameResolver`** — extracts and normalises 
connection-source names from a datastore without leaking 
`ConnectionSourcesSupport` internals
   - **`GormEnhancer`** — delegates all registration and lookup to 
`GormRegistry`; `allQualifiers()` used only for datastore routing, not eager 
API allocation
   - **`GormStaticApi` / `GormInstanceApi` / `GormValidationApi`** — use 
`DatastoreResolver` instead of holding a direct `Datastore` reference; support 
qualifier-aware execution via `executeQualified()`
   - **`AbstractGormApi.execute()`** — distinguishes datasource connection 
qualifiers from tenant-ID qualifiers to avoid overwriting the active tenant 
context
   - **`CurrentTenantHolder`** — thread-safe tenant binding for `DISCRIMINATOR` 
multi-tenancy
   - **`ServiceTransformation` / `TransactionalTransform`** — resolve 
transaction manager via `GormRegistry` instead of static map lookups
   - **`DefaultTransactionTemplateFactory` / `TransactionTemplateFactory`** — 
pluggable transaction template creation per datastore type
   
   ## Test plan
   
   - [ ] `./gradlew :grails-datamapping-core:test` passes (tests are in the 
companion PR)
   - [ ] No regressions in `GormEnhancerAllQualifiersSpec`
   
   ## Stack
   
   - Prereq: #15779 (`feat/gorm-datastore-infra`)
   - **This PR** — implementation only (production code)
   - Next: `feat/gorm-registry-core-tests` — full test suite for this PR
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to