o ö]LbBã@s0ddlmZGdd„deƒZGdd„deƒZdS)é)Úabsolute_importc@speZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„ZdS)ÚindexapiaClass 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(...) ... cCódS)z*Initializes the metadata store connection.N©©Úselfrrú=/usr/lib/python3/dist-packages/hgext/infinitepush/indexapi.pyÚ__init__ózindexapi.__init__cCr)z(Cleans up the metadata store connection.NrrrrrÚcloser zindexapi.closecCs|S©NrrrrrÚ __enter__ózindexapi.__enter__cCsdSr r)rÚexc_typeÚexc_valÚexc_tbrrrÚ__exit__rzindexapi.__exit__cCótƒ‚)zcTakes a bundleid and a list of node contexts for each node in that bundle and records that.©ÚNotImplementedError)rÚbundleidÚnodesctxrrrÚ addbundle"ózindexapi.addbundlecCr)zRTakes a bookmark name and hash, and records mapping in the metadata store.r)rÚbookmarkÚnoderrrÚ addbookmark'rzindexapi.addbookmarkcCr)zbTakes a dict with mapping from bookmark to hash and records mapping in the metadata store.r)rÚ bookmarksrrrÚaddmanybookmarks,rzindexapi.addmanybookmarkscCr)z+Accepts list of bookmarks and deletes them.r)rÚpatternsrrrÚdeletebookmarks1ózindexapi.deletebookmarkscCr)zAReturns the bundleid for the bundle that contains the given node.r)rrrrrÚ getbundle5r!zindexapi.getbundlecCr)zBReturns the node for the given bookmark. None if it doesn't exist.r)rrrrrÚgetnode9r!zindexapi.getnodecCr)z&Returns bookmarks that match the queryr)rÚqueryrrrÚ getbookmarks=r!zindexapi.getbookmarkscCr)z(Saves optional metadata for a given noder)rrÚ jsonmetadatarrrÚsaveoptionaljsonmetadataAr!z!indexapi.saveoptionaljsonmetadataN)Ú__name__Ú __module__Ú __qualname__Ú__doc__r r r rrrrr r"r#r%r'rrrrr s  rc@s eZdZdS)ÚindexexceptionN)r(r)r*rrrrr,Fsr,N)Ú __future__rÚobjectrÚ Exceptionr,rrrrÚs ;