CLI三层架构重构完成:interface/metadata/storage/tools层
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled

架构设计:
- 上层(interface):虚拟操作系统层
  - web.rs: HTTP Server
  - ssh.rs: SSH/SFTP Server
  - webdav.rs: WebDAV Server
  - iscsi.rs: iSCSI Server
  - tree.rs: File Tree管理(categories/series)

- 中层(metadata):核心数据库层
  - config.rs: 配置管理(从framework.rs迁移)
  - user.rs: 用户管理
  - db.rs: 数据库管理
  - auth.rs: 认证授权

- 底层(storage):文件存取层
  - scan.rs: 文件扫描导入(从framework.rs迁移)
  - hash.rs: 哈希计算(从framework.rs迁移)
  - archive.rs: 压缩解压缩
  - sync.rs: 文件同步
  - mount.rs: 存储挂载

- 辅助工具(tools):辅助功能
  - render.rs: Markdown渲染(从framework.rs迁移)
  - test.rs: 测试命令(从framework.rs迁移)

架构优势:
 清晰的三层分离,符合架构理念
 21个独立模块,职责清晰
 main.rs简化至23行,cli/mod.rs24行
 删除旧架构(cli/apps和framework.rs)
 编译成功,所有CLI命令可用

命令範例:
markbase interface web start --port 11438
markbase interface ssh start --port 2024
markbase interface tree import --user accusys --tree-type categories
markbase metadata config show
markbase storage scan directory --user accusys --dir data/downloads
markbase tools render file --file README.md

文件统计:
- 新增文件:20个Rust模块
- 删除文件:3个旧架构文件
- 修改文件:2个核心入口
- 总计:21个文件变更
This commit is contained in:
Warren
2026-06-13 01:36:15 +08:00
parent 499efed099
commit cdc2e4b9d6
25 changed files with 881 additions and 480 deletions

View File

@@ -0,0 +1,32 @@
pub mod web;
pub mod ssh;
pub mod webdav;
pub mod iscsi;
pub mod tree;
use clap::Subcommand;
#[derive(Subcommand)]
pub enum InterfaceCommands {
#[command(flatten)]
Web(web::WebCommand),
#[command(flatten)]
Ssh(ssh::SshCommand),
#[command(flatten)]
Webdav(webdav::WebdavCommand),
#[command(flatten)]
Iscsi(iscsi::IscsiCommand),
#[command(flatten)]
Tree(tree::TreeCommand),
}
pub async fn handle_interface_command(cmd: InterfaceCommands) -> anyhow::Result<()> {
match cmd {
InterfaceCommands::Web(c) => web::handle_web_command(c).await?,
InterfaceCommands::Ssh(c) => ssh::handle_ssh_command(c).await?,
InterfaceCommands::Webdav(c) => webdav::handle_webdav_command(c).await?,
InterfaceCommands::Iscsi(c) => iscsi::handle_iscsi_command(c).await?,
InterfaceCommands::Tree(c) => tree::handle_tree_command(c).await?,
}
Ok(())
}