def link(self, dircap, childname, childcap): dircap_hash = trunchash(dircap) childcap_hash = trunchash(childcap) log.debug( 'Linking "%s" (%s) into %s...', childname, childcap_hash, dircap_hash, ) yield self.await_ready() yield self.lock.acquire() try: resp = yield treq.post("{}uri/{}/?t=uri&name={}&uri={}".format( self.nodeurl, dircap, childname, childcap)) finally: yield self.lock.release() if resp.code != 200: content = yield treq.content(resp) raise TahoeWebError(content.decode("utf-8")) log.debug( 'Done linking "%s" (%s) into %s', childname, childcap_hash, dircap_hash, )
def process_status(self, status): remote_scan_needed = False state, kind, filepath, _ = self.parse_status(status) if state == MagicFolderChecker.SYNCING: if self.state != MagicFolderChecker.SYNCING: # Sync just started logging.debug("Sync started (%s)", self.name) self.sync_started.emit() elif self.state == MagicFolderChecker.SYNCING: # Sync started earlier; still going logging.debug( 'Sync in progress (%sing "%s" in "%s")...', kind, trunchash(filepath), self.name, ) # TODO: Emit uploading/downloading signal? self.emit_transfer_signals(self.operations.values()) remote_scan_needed = True elif state == MagicFolderChecker.UP_TO_DATE: if self.state == MagicFolderChecker.SYNCING: # Sync just finished logging.debug("Sync complete (%s); doing final scan...", self.name) remote_scan_needed = True state = MagicFolderChecker.SCANNING elif self.state == MagicFolderChecker.SCANNING: # Final scan just finished logging.debug("Final scan complete (%s)", self.name) self.sync_finished.emit() self.notify_updated_files() self.operations = {} if state != self.state: self.status_updated.emit(state) self.state = state # TODO: Notify failures/conflicts return remote_scan_needed
def unlink(self, dircap, childname): dircap_hash = trunchash(dircap) log.debug('Unlinking "%s" from %s...', childname, dircap_hash) yield self.await_ready() yield self.lock.acquire() try: resp = yield treq.post('{}uri/{}/?t=unlink&name={}'.format( self.nodeurl, dircap, childname)) finally: yield self.lock.release() if resp.code != 200: content = yield treq.content(resp) raise TahoeWebError(content.decode('utf-8')) log.debug('Done unlinking "%s" from %s', childname, dircap_hash)
def get_mask(string, tag, identifier=None): if identifier: return "<Filtered:{}>".format(tag + ":" + identifier) return "<Filtered:{}>".format(tag + ":" + trunchash(string))
def get_mask(string, tag, identifier=None): if identifier: return '<Filtered:{}>'.format(tag + ':' + identifier) return '<Filtered:{}>'.format(tag + ':' + trunchash(string))