portage._emirrordist.ContentDB module

class portage._emirrordist.ContentDB.ContentDB(shelve_instance: shelve.Shelf)

Bases: object

The content db serves to translate content digests to distfiles names, and distfiles names to content digests. All keys have one or more prefixes separated by colons. For a digest key, the first prefix is “digest” and the second prefix is the hash algorithm name. For a filename key, the prefix is “filename”.

The value associated with a digest key is a set of file names. The value associated with a distfile key is a set of content revisions. Each content revision is expressed as a dictionary of digests which is suitable for construction of a DistfileName instance.

add(filename: portage.package.ebuild.fetch.DistfileName)

Add file name and digests, creating a new content revision, or incrementing the reference count to an identical content revision if one exists. If the file name had previous content revisions, then they continue to exist independently of the new one.


filename – file name with digests attribute

get(k, *args)
get_filenames_translate(filename: Union[str, portage.package.ebuild.fetch.DistfileName]) → Generator[portage.package.ebuild.fetch.DistfileName, None, None]

Translate distfiles content digests to zero or more distfile names. If filename is already a distfile name, then it will pass through unchanged.

A given content digest will translate to multiple distfile names if multiple associations have been created via the add method. The relationship between a content digest and a distfile name is similar to the relationship between an inode and a hardlink.


filename – A filename listed by layout get_filenames

remove(filename: portage.package.ebuild.fetch.DistfileName)

Remove a file name and digests from the database. If identical content is still referenced by one or more other file names, then those references are preserved (like removing one of many hardlinks). Also, this file name may reference other content revisions with different digests, and those content revisions will remain as well.


filename – file name with digests attribute