Logo Search packages:      
Sourcecode: ubuntuone-client version File versions

def ubuntuone::syncdaemon::filesystem_manager::FileSystemManager::commit_partial (   self,

Creates a .partial in disk and set the flag in metadata.

Definition at line 635 of file filesystem_manager.py.

00635                                                            :
        '''Creates a .partial in disk and set the flag in metadata.'''
        mdid = self._idx_node_id[(share_id, node_id)]
        mdobj = self.fs[mdid]
        if mdobj["is_dir"]:
            raise ValueError("Directory partials can not be commited!")
        if not self._check_partial(mdid):
            raise ValueError("The object with share_id %r and node_id %r is "
                             "not partial!" % (share_id, node_id))

        # move the .partial to the real path, and set the md info
        path = self.get_abspath(mdobj['share_id'], mdobj['path'])
        logger("commit_partial: path=%r mdid=%r share_id=%r node_id=%r" %
                                            (path, mdid, share_id, node_id))

        partial_path = path + ".partial"
        partial_context =  self._enable_share_write(share_id, partial_path)
        path_context = self._enable_share_write(share_id, path)
        with contextlib.nested(partial_context, path_context):
            shutil.move(path + ".partial", path)
        mdobj["local_hash"] = local_hash
        mdobj["info"]["last_downloaded"] = time.time()
        mdobj["info"]["is_partial"] = False
        mdobj["stat"] = os.stat(path)
        self.fs[mdid] = mdobj

    def remove_partial(self, node_id, share_id):

Generated by  Doxygen 1.6.0   Back to index