Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9311898
D4792.id16964.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D4792.id16964.diff
View Options
diff --git a/swh/fuse/fs/mountpoint.py b/swh/fuse/fs/mountpoint.py
--- a/swh/fuse/fs/mountpoint.py
+++ b/swh/fuse/fs/mountpoint.py
@@ -35,6 +35,7 @@
yield self.create_child(ArchiveDir)
yield self.create_child(OriginDir)
yield self.create_child(CacheDir)
+ yield self.create_child(Readme)
@dataclass
@@ -193,3 +194,38 @@
name=OriginDir.name,
target=Path(self.get_relative_root_path(), OriginDir.name),
)
+
+
+@dataclass
+class Readme(FuseFileEntry):
+ """ Top-level README to explain briefly what is SwhFS. """
+
+ name: str = field(init=False, default="README")
+ mode: int = field(init=False, default=int(EntryMode.RDONLY_FILE))
+
+ CONTENT = """Welcome to the Software Heritage Filesystem (SwhFS)!
+
+This is a user-space POSIX filesystem to browse the Software Heritage archive,
+as if it were locally available. The SwhFS mount point contains 3 directories,
+all initially empty and lazily populated:
+
+- "archive": virtual directory to mount any Software Heritage artifact on the
+ fly using its SWHID as name. Note: this directory cannot be listed with ls,
+ but entries in it can be accessed (e.g., using cat or cd).
+- "origin": virtual directory to mount any origin using its encoded URL as name.
+- "cache": on-disk representation of locally cached objects and metadata.
+
+Try it yourself:
+
+ $ cat archive/swh:1:cnt:c839dea9e8e6f0528b468214348fee8669b305b2
+ #include <stdio.h>
+
+ int main(void) {
+ printf("Hello, World!\\n");
+ }
+
+You can find more details and examples in the SwhFS online documentation:
+https://docs.softwareheritage.org/devel/swh-fuse/ """
+
+ async def get_content(self) -> bytes:
+ return self.CONTENT.encode()
diff --git a/swh/fuse/tests/test_mountpoint.py b/swh/fuse/tests/test_mountpoint.py
--- a/swh/fuse/tests/test_mountpoint.py
+++ b/swh/fuse/tests/test_mountpoint.py
@@ -10,7 +10,7 @@
def test_mountpoint(fuse_mntdir):
- assert {"archive", "cache", "origin"} <= set(os.listdir(fuse_mntdir))
+ assert {"archive", "cache", "origin", "README"} <= set(os.listdir(fuse_mntdir))
def test_on_the_fly_mounting(fuse_mntdir):
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 2, 10:35 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3218329
Attached To
D4792: FUSE: fs: add top-level README file to explain briefly SwhFS
Event Timeline
Log In to Comment