a
    %0ษ_K  ใ                   @   s0   d dl mZ G dd deZG dd deZdS )้    )ฺabsolute_importc                   @   sp   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd ZdS )ฺindexapia  Class that manages access to infinitepush index.

    This class is a context manager and all write operations (like
    deletebookmarks, addbookmark etc) should use `with` statement:

      with index:
          index.deletebookmarks(...)
          ...
    c                 C   s   dS )z*Initializes the metadata store connection.Nฉ ฉฺselfr   r   ๚=/usr/lib/python3/dist-packages/hgext/infinitepush/indexapi.pyฺ__init__   s    zindexapi.__init__c                 C   s   dS )z(Cleans up the metadata store connection.Nr   r   r   r   r   ฺclose   s    zindexapi.closec                 C   s   | S ฉNr   r   r   r   r   ฺ	__enter__   s    zindexapi.__enter__c                 C   s   d S r
   r   )r   ฺexc_typeZexc_valZexc_tbr   r   r   ฺ__exit__   s    zindexapi.__exit__c                 C   s
   t  dS )zcTakes a bundleid and a list of node contexts for each node
        in that bundle and records that.NฉฺNotImplementedError)r   ZbundleidZnodesctxr   r   r   ฺ	addbundle"   s    zindexapi.addbundlec                 C   s
   t  dS )zRTakes a bookmark name and hash, and records mapping in the metadata
        store.Nr   )r   ฺbookmarkฺnoder   r   r   ฺaddbookmark'   s    zindexapi.addbookmarkc                 C   s
   t  dS )zbTakes a dict with mapping from bookmark to hash and records mapping
        in the metadata store.Nr   )r   Z	bookmarksr   r   r   ฺaddmanybookmarks,   s    zindexapi.addmanybookmarksc                 C   s
   t  dS )z4Accepts list of bookmarks and deletes them.
        Nr   )r   Zpatternsr   r   r   ฺdeletebookmarks1   s    zindexapi.deletebookmarksc                 C   s
   t  dS )zAReturns the bundleid for the bundle that contains the given node.Nr   )r   r   r   r   r   ฺ	getbundle6   s    zindexapi.getbundlec                 C   s
   t  dS )zBReturns the node for the given bookmark. None if it doesn't exist.Nr   )r   r   r   r   r   ฺgetnode:   s    zindexapi.getnodec                 C   s
   t  dS )z&Returns bookmarks that match the queryNr   )r   Zqueryr   r   r   ฺgetbookmarks>   s    zindexapi.getbookmarksc                 C   s
   t  dS )z(Saves optional metadata for a given nodeNr   )r   r   Zjsonmetadatar   r   r   ฺsaveoptionaljsonmetadataB   s    z!indexapi.saveoptionaljsonmetadataN)ฺ__name__ฺ
__module__ฺ__qualname__ฺ__doc__r   r	   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      s   
r   c                   @   s   e Zd ZdS )ฺindexexceptionN)r   r   r   r   r   r   r   r   G   s   r   N)Z
__future__r   ฺobjectr   ฺ	Exceptionr   r   r   r   r   ฺ<module>   s   <