def read(self, fh, offset, length): ppath = "/tmp/{}".format(j.sal.fs.getBaseName(self.inode_path[fh])) g8os_stor.downloadFile0(self.client, ppath, self.inode_hash[fh]) with open(ppath, "rb") as f: data = f.read() j.sal.fs.remove(ppath) return data[offset:offset + length]
def release(self, fh): data = None if self.inode_buffer.get(fh, None): ppath = '/tmp/{}'.format(j.sal.fs.getBaseName(self.inode_path[fh])) if self.inode_hash.get(fh, None): g8os_stor.downloadFile0(self.client, ppath, self.inode_hash[fh]) with open(ppath) as f: data = f.read() with open(ppath, 'wb') as f: if data is None: data = self.inode_buffer.pop(fh) else: data = bytes(data, 'utf-8') + self.inode_buffer[fh] f.write(data) self.inode_hash[fh] = g8os_stor.uploadFile0(self.client, ppath, 0) j.sal.fs.remove(ppath)