refactor(actor): implement Raft consensus algorithm for cluster leader election
- Add voting mechanism with term tracking and vote persistence - Implement election triggering logic with majority vote counting - Add primary/replica role transition handling with state management - Integrate health check failure detection for automatic elections - Refactor actor messaging system for distributed coordination - Update repository registration to query cluster for existing primary - Add broadcast mechanism for role change notifications - Implement proper term comparison and duplicate request filtering - Upgrade dependency versions including tokio-util for async utilities - Optimize code formatting and line wrapping for improved readability - Remove redundant blank lines and improve code structure consistency - Enhance error logging and trace information for debugging purposes
This commit is contained in:
@@ -94,7 +94,6 @@ impl DiskCache {
|
||||
self.enabled
|
||||
}
|
||||
|
||||
|
||||
fn state_dir_for(&self, relative_path: &str) -> PathBuf {
|
||||
self.repo_prefix
|
||||
.join(STATE_DIR_RELATIVE)
|
||||
@@ -109,7 +108,6 @@ impl DiskCache {
|
||||
self.state_dir_for(relative_path).join("pending")
|
||||
}
|
||||
|
||||
|
||||
fn cache_dir(&self, namespace: &str) -> PathBuf {
|
||||
self.repo_prefix.join(namespace)
|
||||
}
|
||||
@@ -118,7 +116,6 @@ impl DiskCache {
|
||||
self.cache_dir(namespace).join(digest_to_path(digest))
|
||||
}
|
||||
|
||||
|
||||
/// Ensure the state directory for a repository exists and has a `latest` file.
|
||||
/// If `latest` does not exist, create it with a random value.
|
||||
pub fn ensure_state(&self, relative_path: &str) -> GitResult<String> {
|
||||
@@ -230,7 +227,6 @@ impl DiskCache {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
/// Compute a cache key for an info/refs request.
|
||||
pub fn compute_info_refs_key(&self, relative_path: &str, protocol: &str) -> GitResult<String> {
|
||||
let latest = self.ensure_state(relative_path)?;
|
||||
@@ -268,7 +264,6 @@ impl DiskCache {
|
||||
Ok(sha256_digest(parts))
|
||||
}
|
||||
|
||||
|
||||
/// Look up a cached response for the given namespace and digest.
|
||||
/// Returns the cached bytes if found and not expired.
|
||||
pub fn lookup(&self, namespace: &str, digest: &str) -> GitResult<Option<Vec<u8>>> {
|
||||
|
||||
Reference in New Issue
Block a user