Refactor RPC Authentication System for Improved Maintainability (#1391)

This commit is contained in:
weisd
2026-01-05 19:51:51 +08:00
committed by GitHub
parent 0b6f3302ce
commit 5660208e89
15 changed files with 697 additions and 299 deletions
+5 -14
View File
@@ -13,7 +13,7 @@
// limitations under the License.
pub mod local;
pub mod remote;
// pub mod remote;
use async_trait::async_trait;
use std::sync::Arc;
@@ -74,10 +74,10 @@ impl ClientFactory {
Arc::new(local::LocalClient::new())
}
/// Create remote client
pub fn create_remote(endpoint: String) -> Arc<dyn LockClient> {
Arc::new(remote::RemoteClient::new(endpoint))
}
// /// Create remote client
// pub fn create_remote(endpoint: String) -> Arc<dyn LockClient> {
// Arc::new(remote::RemoteClient::new(endpoint))
// }
}
#[cfg(test)]
@@ -85,15 +85,6 @@ mod tests {
use super::*;
use crate::types::LockType;
#[tokio::test]
async fn test_client_factory() {
let local_client = ClientFactory::create_local();
assert!(local_client.is_local().await);
let remote_client = ClientFactory::create_remote("http://localhost:8080".to_string());
assert!(!remote_client.is_local().await);
}
#[tokio::test]
async fn test_local_client_basic_operations() {
let client = ClientFactory::create_local();