implement cluster stubs: cross-node routing, rebalancing, and actor migration #158

Open
HugoNijhuis wants to merge 3 commits from implement-cluster-stubs into main
3 Commits
Author SHA1 Message Date
HugoNijhuis 443425d6e3 fix cluster stubs: deterministic fallback, payload forwarding, and handler guards
CI / build (pull_request) Successful in 40s
- Replace non-deterministic map range fallback with sorted node selection in PlaceActor and RebalanceShards
- Add Body field to MessagePayload to preserve message data during cross-node routing
- Forward actual message body in route_message handler instead of discarding it
- Add self-message guard to route_message handler to prevent loops
- Add nil guard for shardMap in handleRebalanceRequest
- Add self-message guard to handleRebalanceRequest in DistributedVM
2026-07-30 18:23:48 +02:00
HugoNijhuis 70eddbc533 fix cluster: hashRing stale after rebalance, GetShardMap empty, loops, and migration no-op
- GetShardMap: copy Shards and Nodes map contents before returning
- hashRing: rebuild from shardMap.Nodes after every rebalance/shard_map update
- DistributedVM.handleRebalanceRequest: add leader check and self-broadcast guard
- route_message: add hop-count (MaxRouteHops=10) to prevent infinite loops
- handleMigrationRequest: broadcast migration updates instead of setting local copy
2026-07-30 00:35:07 +02:00
HugoNijhuis 9970c99509 implement cluster stubs: cross-node routing, rebalancing, and actor migration
CI / build (pull_request) Successful in 42s
- Fix ConsistentHashPlacement.PlaceActor() to use consistent hash ring
- Implement ConsistentHashPlacement.RebalanceShards() to redistribute shards
- Implement ClusterManager.handleRebalanceRequest() with actual rebalancing
- Implement ClusterManager.handleMigrationRequest() for actor state transfer
- Implement ClusterManager.triggerShardRebalancing() to compute and broadcast
- Implement DistributedVM.SendMessage() with cross-node NATS routing
- Implement DistributedVM.handleRebalanceRequest() to update shard map
- Fix route_message handler to check if actor is local before delivery
- Update ConsistentHashPlacement.RebalanceShards() test for new behavior
- Add handleShardMapUpdate() and broadcastShardMap() to ClusterManager
2026-07-29 20:03:23 +02:00