Your IP : 216.73.217.7
�
�h
���dZddlmZddlmZmZddlmZmZddl m
Z
mZddlm
Z
mZddlmZdZGd �d
ee��ZdS)z*Contains the MemoryDatabase implementation�)�
LooseObjectDB)� ObjectDBR� ObjectDBW)�OStream�IStream)� BadObject�UnsupportedOperation)�ZippedStoreShaWriter�DecompressMemMapReader)�BytesIO)�MemoryDBc�R��eZdZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�Z�xZ
S)r
a/A memory database stores everything to memory, providing fast IO and object
retrieval. It should be used to buffer results and obtain SHAs before writing
it to the actual physical storage, as it allows to query whether object already
exists in the target storage before introducing actual IOc���t�����td��|_t ��|_dS)Nzpath/doesnt/matter)�super�__init__r�_db�dict�_cache)�self� __class__s ��]/builddir/build/BUILD/cloudlinux-venv-1.0.8/venv/lib/python3.11/site-packages/gitdb/db/mem.pyrzMemoryDB.__init__'s:���
�������� �!5�6�6����f�f�����c� �td���)Nz$MemoryDB's always stream into memory)r )r�streams r�set_ostreamzMemoryDB.set_ostream.s��"�#I�J�J�Jrc�~�t��}|j�|��|j�|��}|���|�d��t
|���d���}t|j |j
|j|��|j|j <|S)NrF)�close_on_deletion)
r
rr�store�close�seekr�getvaluer�binsha�type�sizer)r�istream�zstream�
decomp_streams rrzMemoryDB.store1s���&�(�(������W�%�%�%��(�.�.��)�)���
�
�������Q����/�w�/?�/?�/A�/A�UZ�[�[�[�
�&-�g�n�g�l�G�L�Zg�&h�&h���G�N�#��rc��||jvS�N)r�r�shas r�
has_objectzMemoryDB.has_object@s���d�k�!�!rc�,�|�|��Sr))rr*s r�infoz
MemoryDB.infoCs���{�{�3���rc�� |j|}|j�d��|S#t$r}t |��|�d}~wwxYw)Nr)rrr �KeyErrorr)rr+�ostream�es rrzMemoryDB.streamGs[�� (��k�#�&�G��N����"�"�"��N��� (� (� (��C�.�.�a�'����� (���s�(+�
A
�A�A
c�*�t|j��Sr))�lenr�rs rr$z
MemoryDB.sizeQs���4�;���rc�4�|j���Sr))r�keysr5s r�sha_iterzMemoryDB.sha_iterTs���{���!�!�!rc�"�d}|D]�}|�|��r�|�|��}t|j�����}t |j|j||��}|�|��|dz
}��|S)arCopy the streams as identified by sha's yielded by sha_iter into the given odb
The streams will be copied directly
**Note:** the object will only be written if it did not exist in the target db
:return: amount of streams actually copied into odb. If smaller than the amount
of input shas, one or more objects did already exist in odbr�)r,rr�datarr#r$r)rr8�odb�countr+r1�sior%s r�stream_copyzMemoryDB.stream_copyXs������ � �C��~�~�c�"�"�
���k�k�#�&�&�G��'�.�-�-�/�/�0�0�C��g�l�G�L�#�s�C�C�G��I�I�g�����Q�J�E�E��r)�__name__�
__module__�__qualname__�__doc__rrrr,r.rr$r8r?�
__classcell__)rs@rr
r
s��������A�A�
�����K�K�K�
�
�
�"�"�"� � � �(�(�(� � � �"�"�"�������rr
N)rC�gitdb.db.looser�
gitdb.db.baserr�
gitdb.baserr� gitdb.excrr �gitdb.streamr
r�ior�__all__r
�rr�<module>rMs��
1�0�(�(�(�(�(�(���������
��������
��������
��������
������
��M�M�M�M�M�y�)�M�M�M�M�Mr
?>