Qiao-yq opened a new pull request, #973:
URL: https://github.com/apache/dubbo-go-pixiu/pull/973
**What this PR does**:
This PR completes the config-runtime decoupling identified as technical debt
in #932. It establishes a clear boundary between the configuration layer
(ClusterConfig) and the runtime layer (Cluster), ensuring that mutations in one
do not leak into the other.
**Changes**:
1. **Config identity without pointer comparison**
- Added `ConfigID` (atomic sequence) to `ClusterConfig` for stable
identity after deep copy
- Added `ConfigIsIdenticalTo()` to replace fragile pointer comparisons
- Added `CloneClusterConfig()` helper with independent copies of
Endpoints, HealthChecks, and ConsistentHash
2. **Private `Cluster.config` with getter**
- Renamed `Cluster.Config` → unexported `config` with `Config()` getter
- Prevents external code from bypassing encapsulation
3. **RoundRobin cursor moved to runtime**
- Added `RuntimeState` struct on `Cluster` holding `roundRobinCursor`
- Added `RoundRobinCursor` field to `loadbalancer.PickContext`
- Snapshot-path RoundRobin now uses the runtime-owned cursor;
`PrePickEndpointIndex` is legacy fallback only
4. **Deep copy on runtime publication**
- `replaceClusterRuntimeWithSnapshot` now deep-copies config via
`CloneClusterConfig`, so store and runtime hold independent objects
**Which issue(s) this PR fixes**:
Fixes #958
**Special notes for your reviewer**:
NONE
**Does this PR introduce a user-facing change?**:
```release-note
NONE
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]