From d0387aa31d2c5cea15a0f9515a8bdb25888ddddc Mon Sep 17 00:00:00 2001 From: blissful Date: Tue, 10 Oct 2023 13:06:04 -0400 Subject: [PATCH] set up boilerplate for virtualfs - impl nopfs --- rose/__main__.py | 13 +++++++++++++ rose/virtualfs/__init__.py | 15 +++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 rose/virtualfs/__init__.py diff --git a/rose/__main__.py b/rose/__main__.py index 1efbd6a..1fc4c09 100644 --- a/rose/__main__.py +++ b/rose/__main__.py @@ -6,6 +6,7 @@ from rose.cache.database import migrate_database from rose.cache.update import update_cache_for_all_releases from rose.foundation.conf import Config +from rose.virtualfs import start_virtualfs @dataclass @@ -48,5 +49,17 @@ def clear(c: Context) -> None: c.config.cache_database_path.unlink() +@cli.group() +def fs() -> None: + """Manage the virtual library.""" + + +@cli.command() +@click.pass_obj +def mount(c: Context) -> None: + """Mount the virtual library.""" + start_virtualfs(c.config) + + if __name__ == "__main__": cli() diff --git a/rose/virtualfs/__init__.py b/rose/virtualfs/__init__.py new file mode 100644 index 0000000..7e16271 --- /dev/null +++ b/rose/virtualfs/__init__.py @@ -0,0 +1,15 @@ +import fuse + +from rose.foundation.conf import Config + +fuse.fuse_python_api = (0, 2) + + +class VirtualFS(fuse.Fuse): + pass + + +def start_virtualfs(c: Config): + server = VirtualFS() + server.parse([str(c.fuse_mount_dir)]) + server.main()