File: //lib/python3/dist-packages/landscape/lib/apt/package/__pycache__/store.cpython-38.pyc
U
���c^B � @ s� d Z ddlZzddlZW n ek
r8 ddlmZ Y nX ddlmZmZ ddl m
Z
ddlmZ G dd� de
�ZG d d
� d
e
�ZG dd� de�ZG d
d� de�ZG dd� de�ZG dd� de�ZG dd� de�Zdd� Zdd� Zdd� ZdS )zEProvide access to the persistent data used by L{PackageTaskHandler}s.� N)�dbapi2)� iteritems�long)�bpickle)�with_cursorc @ s e Zd ZdZdS )�UnknownHashIDRequestz$Raised for unknown hash id requests.N��__name__�
__module__�__qualname__�__doc__� r
r
�A/usr/lib/python3/dist-packages/landscape/lib/apt/package/store.pyr s r c @ s e Zd ZdZdS )�InvalidHashIdDbzARaised when trying to add an invalid hash=>id lookaside database.Nr r
r
r
r r s r c @ sl e Zd ZdZdZdd� Zdd� Zedd� �Zed d
� �Z edd� �Z
ed
d� �Zedd� �Zedd� �Z
dS )�HashIdStorea C{HashIdStore} stores package hash=>id mappings in a file.
The file is a SQLite database that contains a single table called "hash".
The table schema is defined in L{ensure_hash_id_schema}.
@param filename: The file where the mappings are persisted to.
Nc C s
|| _ d S �N)� _filename��self�filenamer
r
r �__init__! s zHashIdStore.__init__c C s t | j� d S r )�ensure_hash_id_schema�_db�r r
r
r �_ensure_schema$ s zHashIdStore._ensure_schemac C s, t |�D ]\}}|�d|t�|�f� qdS )zbSet the ids of a set of hashes.
@param hash_ids: a C{dict} of hash=>id mappings.
zREPLACE INTO hash VALUES (?, ?)N)r �execute�sqlite3�Binary)r �cursorZhash_ids�hash�idr
r
r �set_hash_ids'