swh.fuse.fuse module

class swh.fuse.fuse.Fuse(root_path: pathlib.Path, cache: swh.fuse.cache.FuseCache, conf: Dict[str, Any])[source]

Bases: _pyfuse3.Operations

Software Heritage Filesystem in Userspace (FUSE). Locally mount parts of the archive and navigate it as a virtual file system.

shutdown() → None[source]
inode2entry(inode: int)swh.fuse.fs.entry.FuseEntry[source]

Return the entry matching a given inode

async get_metadata(swhid: swh.model.identifiers.SWHID) → Any[source]

Retrieve metadata for a given SWHID using Software Heritage API

async get_blob(swhid: swh.model.identifiers.SWHID) → bytes[source]

Retrieve the blob bytes for a given content SWHID using Software Heritage API

async get_history(swhid: swh.model.identifiers.SWHID) → List[swh.model.identifiers.SWHID][source]

Retrieve a revision’s history using Software Heritage Graph API

async get_visits(url_encoded: str) → List[Dict[str, Any]][source]

Retrieve origin visits given an encoded-URL using Software Heritage API

async get_attrs(entry: swh.fuse.fs.entry.FuseEntry) → pyfuse3.EntryAttributes[source]

Return entry attributes

async getattr(inode: int, _ctx: pyfuse3.RequestContext) → pyfuse3.EntryAttributes[source]

Get attributes for a given inode

async opendir(inode: int, _ctx: pyfuse3.RequestContext) → int[source]

Open a directory referred by a given inode

async readdir(fh: int, offset: int, token: pyfuse3.ReaddirToken) → None[source]

Read entries in an open directory

async open(inode: int, _flags: int, _ctx: pyfuse3.RequestContext) → pyfuse3.FileInfo[source]

Open an inode and return a unique file handle

async read(fh: int, offset: int, length: int) → bytes[source]

Read length bytes from file handle fh at position offset

async lookup(parent_inode: int, name: str, _ctx: pyfuse3.RequestContext) → pyfuse3.EntryAttributes[source]

Look up a directory entry by name and get its attributes

Return target of symbolic link inode.

ctx will be a RequestContext instance.

Remove a file

async swh.fuse.fuse.main(swhids: List[swh.model.identifiers.SWHID], root_path: pathlib.Path, conf: Dict[str, Any]) → None[source]

swh-fuse CLI entry-point