refactor(actor): implement replica sync and ref update notification system

- Add is_write parameter to remote clients for read/write routing distinction
- Introduce RepoEntry struct with role tracking (primary/replica) for repositories
- Replace HashSet with HashMap for repository storage with role metadata
- Add ROLE_PRIMARY and ROLE_REPLICA constants for node role identification
- Implement FindPrimary and FindReplica RPC methods for role-based routing
- Add RefUpdateEvent message type for propagating reference updates
- Create sync module with BundleApplicator for handling replica synchronization
- Implement notify_ref_update calls after branch/tag/commit operations
- Add broadcast_ref_update function to propagate events across cluster nodes
- Modify route_repository to prioritize primary for writes and replicas for reads
- Update actor message handling to support role-based repository discovery
- Implement sync_from_primary function using pack protocol for incremental updates
This commit is contained in:
zhenyi
2026-06-08 01:54:08 +08:00
parent 5c99b27421
commit 8c95eb230d
16 changed files with 518 additions and 105 deletions
+3 -1
View File
@@ -41,7 +41,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
storage_name.clone(),
grpc_addr.clone(),
).await?;
let svc = GitksService::new(repo_prefix.clone()).with_actor(node_actor.clone());
let svc = GitksService::new(repo_prefix.clone())
.with_actor(node_actor.clone())
.with_grpc_addr(grpc_addr.clone());
tracing::info!(
"starting gitks gRPC server on {addr}, repo prefix: {}, storage: {storage_name}, advertise: {grpc_addr}",