當前位置: 首頁>>代碼示例>>Python>>正文


Python pack.PackStreamCopier類代碼示例

本文整理匯總了Python中dulwich.pack.PackStreamCopier的典型用法代碼示例。如果您正苦於以下問題:Python PackStreamCopier類的具體用法?Python PackStreamCopier怎麽用?Python PackStreamCopier使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PackStreamCopier類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: add_thin_pack

    def add_thin_pack(self, read_all, read_some):
        """Add a new thin pack to this object store.

        Thin packs are packs that contain deltas with parents that exist outside
        the pack. They should never be placed in the object store directly, and
        always indexed and completed as they are copied.

        :param read_all: Read function that blocks until the number of requested
            bytes are read.
        :param read_some: Read function that returns at least one byte, but may
            not return the number of bytes requested.
        :return: A Pack object pointing at the now-completed thin pack in the
            objects/pack directory.
        """
        fd, path = tempfile.mkstemp(dir=self.path, prefix='tmp_pack_')
        f = os.fdopen(fd, 'w+b')

        try:
            indexer = PackIndexer(f, resolve_ext_ref=self.get_raw)
            copier = PackStreamCopier(read_all, read_some, f,
                                      delta_iter=indexer)
            copier.verify()
            return self._complete_thin_pack(f, path, copier, indexer)
        finally:
            f.close()
開發者ID:BrenBarn,項目名稱:dreampie,代碼行數:25,代碼來源:object_store.py

示例2: add_thin_pack

 def add_thin_pack(self, read_all, read_some):
     f = StringIO()
     indexer = PackIndexer(f, resolve_ext_ref=self.get_raw)
     copier = PackStreamCopier(read_all, read_some, f, delta_iter=indexer)
     copier.verify()
     pack_store = PackStore(repository=self.REPO)
     final_pack = Pack.from_thinpack(pack_store, f, indexer, resolve_ext_ref=self.get_raw)
     self._add_known_pack(final_pack)
開發者ID:Reidsy,項目名稱:AppengineGit,代碼行數:8,代碼來源:gae_backend.py

示例3: add_thin_pack

    def add_thin_pack(self, read_all, read_some):
        """Read a thin pack

        Read it from a stream and complete it in a temporary file.
        Then the pack and the corresponding index file are uploaded to Swift.
        """
        fd, path = tempfile.mkstemp(prefix='tmp_pack_')
        f = os.fdopen(fd, 'w+b')
        try:
            indexer = PackIndexer(f, resolve_ext_ref=self.get_raw)
            copier = PackStreamCopier(read_all, read_some, f,
                                      delta_iter=indexer)
            copier.verify()
            return self._complete_thin_pack(f, path, copier, indexer)
        finally:
            f.close()
            os.unlink(path)
開發者ID:PKRoma,項目名稱:dulwich,代碼行數:17,代碼來源:swift.py

示例4: add_thin_pack

    def add_thin_pack(self, read_all, read_some):
        """Add a new thin pack to this object store.

        Thin packs are packs that contain deltas with parents that exist outside
        the pack. Because this object store doesn't support packs, we extract
        and add the individual objects.

        :param read_all: Read function that blocks until the number of requested
            bytes are read.
        :param read_some: Read function that returns at least one byte, but may
            not return the number of bytes requested.
        """
        f, commit = self.add_pack()
        indexer = PackIndexer(f, resolve_ext_ref=self.get_raw)
        copier = PackStreamCopier(read_all, read_some, f, delta_iter=indexer)
        copier.verify()
        self._complete_thin_pack(f, indexer)
        commit()
開發者ID:AaronO,項目名稱:dulwich,代碼行數:18,代碼來源:object_store.py


注:本文中的dulwich.pack.PackStreamCopier類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。