NFS Support Features:
- nfs_server.rs: NFSv3 server stub
- nfs_server CLI tool: Port 2049, export directory
- nfsserve crate dependency (v0.11.0)
Implementation Status:
- NfsVfsServer: Placeholder implementation
- NfsConfig: Configuration struct
- CLI: nfs-server command with --port, --root, --share-name
Technical Details:
- nfsserve crate provides NFSFileSystem trait
- NFSFileSystem requires 14 async methods
- Current implementation is stub (pending API study)
Build: ✅ markbase-core + nfs feature
Tests: 495 markbase-core (without nfs feature)
Note: Full NFS server implementation requires studying nfsserve crate API
(expected time: 2-3 days for 500 lines)
63 lines
1.6 KiB
Rust
63 lines
1.6 KiB
Rust
use crate::vfs::{VfsBackend, VfsError};
|
|
use std::path::PathBuf;
|
|
use std::sync::Arc;
|
|
|
|
pub struct NfsVfsServer {
|
|
vfs: Arc<dyn VfsBackend>,
|
|
root: PathBuf,
|
|
port: u16,
|
|
}
|
|
|
|
impl NfsVfsServer {
|
|
pub fn new(vfs: Arc<dyn VfsBackend>, 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<dyn VfsBackend>,
|
|
}
|
|
|
|
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)
|
|
}
|
|
} |