use crate::vfs::{VfsBackend, VfsError}; use std::path::PathBuf; use std::sync::Arc; pub struct NfsVfsServer { vfs: Arc, root: PathBuf, port: u16, } impl NfsVfsServer { pub fn new(vfs: Arc, root: PathBuf) -> Self { Self { vfs, root, port: 2049, } } pub fn with_port(self, port: u16) -> Self { Self { port, ..self } } pub async fn start(&self, port: u16) -> Result<(), VfsError> { #[cfg(feature = "nfs")] { println!("NFS server starting on port {}", port); println!("Export directory: {}", self.root.display()); // TODO: Implement actual NFS server using nfsserve crate // Current implementation is a placeholder Err(VfsError::Unsupported("NFS server implementation pending (requires nfsserve crate API study)".to_string())) } #[cfg(not(feature = "nfs"))] { Err(VfsError::Unsupported("NFS server requires 'nfs' feature".to_string())) } } } pub struct NfsConfig { pub port: u16, pub root: PathBuf, pub vfs: Arc, } impl Default for NfsConfig { fn default() -> Self { Self { port: 2049, root: PathBuf::from("/"), vfs: Arc::new(crate::vfs::local_fs::LocalFs::new()), } } } impl NfsConfig { pub fn build(&self) -> NfsVfsServer { NfsVfsServer::new(self.vfs.clone(), self.root.clone()).with_port(self.port) } }