File: //usr/lib/python3/dist-packages/hgext/infinitepush/__pycache__/store.cpython-310.pyc
o
�]Lb� � @ s� d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ d dl m
Z
d dlmZm
Z
G dd� de�ZG d d
� d
e�ZG dd� de�ZG d
d� de�Zddd�ZG dd� de�ZdS )� )�absolute_importN)�hex)�open)�pycompat)�hashutil�procutilc @ � e Zd ZdS )�BundleWriteExceptionN��__name__�
__module__�__qualname__� r r �:/usr/lib/python3/dist-packages/hgext/infinitepush/store.pyr � r c @ r )�BundleReadExceptionNr
r r r r r r r c @ s2 e Zd ZdZejZejdd� �Zejdd� �Z dS )�abstractbundlestorea6 Defines the interface for bundle stores.
A bundle store is an entity that stores raw bundle data. It is a simple
key-value store. However, the keys are chosen by the store. The keys can
be any Python object understood by the corresponding bundle index (see
``abstractbundleindex`` below).
c C � dS )z�Write bundle data to the store.
This function receives the raw data to be written as a str.
Throws BundleWriteException
The key of the written data MUST be returned.
Nr )�self�datar r r �write( � zabstractbundlestore.writec C r )z�Obtain bundle data for a key.
Returns None if the bundle isn't known.
Throws BundleReadException
The returned object should be a file object supporting read()
and close().
Nr )r �keyr r r �read1 r zabstractbundlestore.readN)
r r r
�__doc__�abc�ABCMeta�
__metaclass__�abstractmethodr r r r r r r s
r c @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� ZdS )
�filebundlestorezkbundle store in filesystem
meant for storing bundles somewhere on disk and on network filesystems
c C sT || _ || _|�dd�| _| js| jj�dd�| _tj�| j�s(t� | j� d S d S )Ns
scratchbranchs storepaths scratchbranchess filebundlestore)
�ui�repo�
configpath� storepath�vfs�join�os�path�exists�makedirs)r r r! r r r �__init__B s ��zfilebundlestore.__init__c C s"