//! Filesystem backend abstraction. //! //! At compile time the active backend is selected by Cargo feature: //! - default → [`prod::ProdBackend`] (real FSKit mount via [`fskit_rs::mount`]). //! - `dev` → [`dev::DevBackend`] (socket-only, no FSKit / no `mount(8)`). //! //! Both expose the same shape via the [`Backend`] trait, so [`crate::main`] //! and any caller can be feature-agnostic. use async_trait::async_trait; use fskit_rs::{Filesystem, MountOptions}; pub type Result = std::result::Result; #[async_trait] pub trait Backend: Send + Sync + Sized + 'static { /// Start the backend; returns once it's ready to accept requests. async fn start(fs: FS, opts: MountOptions) -> Result where FS: Filesystem + Send + Sync + Clone + 'static; /// Short, user-facing description (mount point, socket address, ...). fn describe(&self) -> String; } #[cfg(not(feature = "dev"))] mod prod; #[cfg(not(feature = "dev"))] pub use prod::ProdBackend as ActiveBackend; #[cfg(feature = "dev")] mod dev; #[cfg(feature = "dev")] pub use dev::DevBackend as ActiveBackend; #[derive(thiserror::Error, Debug)] pub enum Error { #[error(transparent)] Session(#[from] fskit_rs::session::Error), #[error(transparent)] DevSession(#[from] fskit_rs::dev_session::Error), }