swh.fuse.fs.artifact module

class swh.fuse.fs.artifact.Content(name: str, mode: int, depth: int, fuse: Fuse, swhid: swh.model.identifiers.SWHID, prefetch: Any = None)[source]

Bases: swh.fuse.fs.entry.FuseFileEntry

Software Heritage content artifact.

swhid

Software Heritage persistent identifier

prefetch

optional prefetched metadata used to set entry attributes

Content leaves (AKA blobs) are represented on disks as regular files, containing the corresponding bytes, as archived.

Note that permissions are associated to blobs only in the context of directories. Hence, when accessing blobs from the top-level archive/ directory, the permissions of the archive/SWHID file will be arbitrary and not meaningful (e.g., 0x644).

swhid: swh.model.identifiers.SWHID
prefetch: Any = None
async get_content() → bytes[source]

Return the content of a file entry

async size() → int[source]

Return the size (in bytes) of an entry

class swh.fuse.fs.artifact.Directory(name: str, mode: int, depth: int, fuse: Fuse, swhid: swh.model.identifiers.SWHID)[source]

Bases: swh.fuse.fs.entry.FuseDirEntry

Software Heritage directory artifact.

swhid

Software Heritage persistent identifier

Directory nodes are represented as directories on the file-system, containing one entry for each entry of the archived directory. Entry names and other metadata, including permissions, will correspond to the archived entry metadata.

Note that the FUSE mount is read-only, no matter what the permissions say. So it is possible that, in the context of a directory, a file is presented as writable, whereas actually writing to it will fail with EPERM.

swhid: swh.model.identifiers.SWHID
class swh.fuse.fs.artifact.Revision(name: str, mode: int, depth: int, fuse: Fuse, swhid: swh.model.identifiers.SWHID)[source]

Bases: swh.fuse.fs.entry.FuseDirEntry

Software Heritage revision artifact.

swhid

Software Heritage persistent identifier

Revision (AKA commit) nodes are represented on the file-system as directories with the following entries:

  • root: source tree at the time of the commit, as a symlink pointing into archive/, to a SWHID of type dir

  • parents/ (note the plural): a virtual directory containing entries named 1, 2, 3, etc., one for each parent commit. Each of these entry is a symlink pointing into archive/, to the SWHID file for the given parent commit

  • parent (note the singular): present if and only if the current commit has at least one parent commit (which is the most common case). When present it is a symlink pointing into parents/1/

  • history: a virtual directory listing all its revision ancestors, sorted in reverse topological order. Each entry is a symlink pointing into archive/SWHID.

  • meta.json: metadata for the current node, as a symlink pointing to the relevant meta/<SWHID>.json file

swhid: swh.model.identifiers.SWHID
class swh.fuse.fs.artifact.RevisionParents(name: str, mode: int, depth: int, fuse: Fuse, parents: List[swh.model.identifiers.SWHID])[source]

Bases: swh.fuse.fs.entry.FuseDirEntry

Revision virtual parents/ directory

parents: List[swh.model.identifiers.SWHID]
class swh.fuse.fs.artifact.RevisionHistory(name: str, mode: int, depth: int, fuse: Fuse, swhid: swh.model.identifiers.SWHID)[source]

Bases: swh.fuse.fs.entry.FuseDirEntry

Revision virtual history/ directory

swhid: swh.model.identifiers.SWHID
class swh.fuse.fs.artifact.Release(name: str, mode: int, depth: int, fuse: Fuse, swhid: swh.model.identifiers.SWHID)[source]

Bases: swh.fuse.fs.entry.FuseDirEntry

Software Heritage release artifact.

swhid

Software Heritage persistent identifier

Release nodes are represented on the file-system as directories with the following entries:

  • target: target node, as a symlink to archive/<SWHID>

  • target_type: regular file containing the type of the target SWHID

  • root: present if and only if the release points to something that (transitively) resolves to a directory. When present it is a symlink pointing into archive/ to the SWHID of the given directory

  • meta.json: metadata for the current node, as a symlink pointing to the relevant meta/<SWHID>.json file

swhid: swh.model.identifiers.SWHID
async find_root_directory(swhid: swh.model.identifiers.SWHID)swh.model.identifiers.SWHID[source]
class swh.fuse.fs.artifact.ReleaseType(name: str, mode: int, depth: int, fuse: Fuse, target_type: str)[source]

Bases: swh.fuse.fs.entry.FuseFileEntry

Release type virtual file

target_type: str
async get_content() → bytes[source]

Return the content of a file entry

async size() → int[source]

Return the size (in bytes) of an entry

class swh.fuse.fs.artifact.Snapshot(name: str, mode: int, depth: int, fuse: Fuse, swhid: swh.model.identifiers.SWHID)[source]

Bases: swh.fuse.fs.entry.FuseDirEntry

Software Heritage snapshot artifact.

swhid

Software Heritage persistent identifier

Snapshot nodes are represented on the file-system as directories with one entry for each branch in the snapshot. Each entry is a symlink pointing into archive/ to the branch target SWHID. Branch names are URL encoded (hence ‘/’ are replaced with ‘%2F’).

swhid: swh.model.identifiers.SWHID