don't use strings for paths

This commit is contained in:
Maxime Van Hees
2025-09-25 16:25:08 +02:00
parent 7f689ae29b
commit 77a53bae86
13 changed files with 54 additions and 41 deletions

View File

@@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::sync::RwLock;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
@@ -165,7 +166,7 @@ pub trait Rpc {
/// RPC Server implementation
pub struct RpcServerImpl {
/// Base directory for database files
base_dir: String,
base_dir: PathBuf,
/// Managed database servers
servers: Arc<RwLock<HashMap<u64, Arc<Server>>>>,
/// Default backend type
@@ -176,7 +177,7 @@ pub struct RpcServerImpl {
impl RpcServerImpl {
/// Create a new RPC server instance
pub fn new(base_dir: String, backend: crate::options::BackendType, admin_secret: String) -> Self {
pub fn new(base_dir: PathBuf, backend: crate::options::BackendType, admin_secret: String) -> Self {
Self {
base_dir,
servers: Arc::new(RwLock::new(HashMap::new())),
@@ -351,7 +352,7 @@ impl RpcServerImpl {
backend,
encrypted,
redis_version: Some("7.0".to_string()),
storage_path: Some(server.option.dir.clone()),
storage_path: Some(server.option.dir.display().to_string()),
size_on_disk,
key_count,
created_at,