def addtmp(self, filename, fileinfo): logging.info('meta addtmp filename %s', filename) key = tmp_key(filename) ret = self.set(key, fileinfo) if ret == RET_SUCCESS: ret = self.expire(key, self.expire_time) return ret
def gettmp(self, filename): logging.info('meta gettmp: file %s', filename) key = tmp_key(filename) return self.get(key)
def deltmp(self, filename): logging.info('meta deltmp: file %s', filename) key = tmp_key(filename) self.delete(key) return True
def hastmp(self, filename): logging.info('meta hastmp: file %s', filename) return self.exists(tmp_key(filename))
def test_tmp_key(): filename = '/testfile' key = tmp_key(filename) eq_(key, 'tmp:/testfile')