swh.fuse.fs.mountpoint module#
- class swh.fuse.fs.mountpoint.Root(fuse: Fuse)[source]#
Bases:
FuseDirEntry
The FUSE mountpoint, consisting of the archive/ and origin/ directories
- async compute_entries() AsyncIterator[FuseEntry] [source]#
Return the child entries of a directory entry
- class swh.fuse.fs.mountpoint.ArchiveDir(depth: int, fuse: Fuse)[source]#
Bases:
FuseDirEntry
The archive/ virtual directory allows to mount any artifact on the fly using its SWHID as name. The associated metadata of the artifact from the Software Heritage Web API can also be accessed through the SWHID.json file (in case of pagination, the JSON file will contain a complete version with all pages merged together). Note: the archive directory cannot be listed with ls, but entries in it can be accessed (e.g., using cat or cd).
- ENTRIES_REGEXP: Pattern | None = re.compile('^(swh:1:(cnt|dir|rel|rev|snp):[0-9a-f]{40})(.json)?$')#
- async compute_entries() AsyncIterator[FuseEntry] [source]#
Return the child entries of a directory entry
- class swh.fuse.fs.mountpoint.MetaEntry(name: str, mode: int, depth: int, fuse: Fuse, swhid: CoreSWHID)[source]#
Bases:
FuseFileEntry
An entry for a archive/<SWHID>.json file, containing all the SWHID’s metadata from the Software Heritage archive.
- class swh.fuse.fs.mountpoint.OriginDir(depth: int, fuse: Fuse)[source]#
Bases:
FuseDirEntry
The origin/ directory is lazily populated with one entry per accessed origin URL (mangled to create a valid UNIX filename). The URL encoding is done using the percent-encoding mechanism described in RFC 3986.
- async compute_entries() AsyncIterator[FuseEntry] [source]#
Return the child entries of a directory entry
- class swh.fuse.fs.mountpoint.CacheDir(depth: int, fuse: Fuse)[source]#
Bases:
FuseDirEntry
The cache/ directory is an on-disk representation of locally cached objects and metadata. Via this directory you can browse cached data and selectively remove them from the cache, freeing disk space. (See swh fs clean in the {ref}`CLI <swh-fuse-cli>` to completely empty the cache). The directory is populated with symlinks to: all artifacts, identified by their SWHIDs and sharded by the first two character of their object id, the metadata identified by a SWHID.json entry, and the origin/ directory.
- class ArtifactShardBySwhid(name: 'str', mode: 'int', depth: 'int', fuse: 'Fuse', prefix: str = '')[source]#
Bases:
FuseDirEntry
- async compute_entries() AsyncIterator[FuseEntry] [source]#
Return the child entries of a directory entry
- async compute_entries() AsyncIterator[FuseEntry] [source]#
Return the child entries of a directory entry
- class swh.fuse.fs.mountpoint.Readme(depth: int, fuse: Fuse)[source]#
Bases:
FuseFileEntry
Top-level README to explain briefly what is SwhFS.
- CONTENT = 'Welcome to the Software Heritage Filesystem (SwhFS)!\n\nThis is a user-space POSIX filesystem to browse the Software Heritage archive,\nas if it were locally available. The SwhFS mount point contains 3 directories,\nall initially empty and lazily populated:\n\n- "archive": virtual directory to mount any Software Heritage artifact on the\n fly using its SWHID as name. Note: this directory cannot be listed with ls,\n but entries in it can be accessed (e.g., using cat or cd).\n- "origin": virtual directory to mount any origin using its encoded URL as name.\n- "cache": on-disk representation of locally cached objects and metadata.\n\nTry it yourself:\n\n $ cat archive/swh:1:cnt:c839dea9e8e6f0528b468214348fee8669b305b2\n #include <stdio.h>\n\n int main(void) {\n printf("Hello, World!\\n");\n }\n\nYou can find more details and examples in the SwhFS online documentation:\nhttps://docs.softwareheritage.org/devel/swh-fuse/ '#