
    	^c                     <     G d  d          Z  G d de          ZdS )c                   Z    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Z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                     dS )z*Initializes the metadata store connection.N selfs    =/usr/lib/python3/dist-packages/hgext/infinitepush/indexapi.py__init__zindexapi.__init__             c                     dS )z(Cleans up the metadata store connection.Nr   r   s    r   closezindexapi.close   r
   r   c                     | S Nr   r   s    r   	__enter__zindexapi.__enter__   s    r   c                     d S r   r   )r   exc_typeexc_valexc_tbs       r   __exit__zindexapi.__exit__   s    r   c                     t                      )zcTakes a bundleid and a list of node contexts for each node
        in that bundle and records that.NotImplementedError)r   bundleidnodesctxs      r   	addbundlezindexapi.addbundle         "###r   c                     t                      )zRTakes a bookmark name and hash, and records mapping in the metadata
        store.r   )r   bookmarknodes      r   addbookmarkzindexapi.addbookmark%   r   r   c                     t                      )zbTakes a dict with mapping from bookmark to hash and records mapping
        in the metadata store.r   )r   	bookmarkss     r   addmanybookmarkszindexapi.addmanybookmarks*   r   r   c                     t                      )z+Accepts list of bookmarks and deletes them.r   )r   patternss     r   deletebookmarkszindexapi.deletebookmarks/       !###r   c                     t                      )zAReturns the bundleid for the bundle that contains the given node.r   )r   r   s     r   	getbundlezindexapi.getbundle3   r'   r   c                     t                      )zBReturns the node for the given bookmark. None if it doesn't exist.r   )r   r   s     r   getnodezindexapi.getnode7   r'   r   c                     t                      )z&Returns bookmarks that match the queryr   )r   querys     r   getbookmarkszindexapi.getbookmarks;   r'   r   c                     t                      )z(Saves optional metadata for a given noder   )r   r   jsonmetadatas      r   saveoptionaljsonmetadataz!indexapi.saveoptionaljsonmetadata?   r'   r   N)__name__
__module____qualname____doc__r	   r   r   r   r   r    r#   r&   r)   r+   r.   r1   r   r   r   r   r   	   s         9 9 97 7 7    $ $ $
$ $ $
$ $ $
$ $ $$ $ $$ $ $$ $ $$ $ $ $ $r   r   c                       e Zd ZdS )indexexceptionN)r2   r3   r4   r   r   r   r7   r7   D   s        Dr   r7   N)r   	Exceptionr7   r   r   r   <module>r9      sb   8$ 8$ 8$ 8$ 8$ 8$ 8$ 8$v	 	 	 	 	Y 	 	 	 	 	r   