"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Tardis/RemoteDB.py" between
Tardis-1.1.5.tar.gz and Tardis-1.2.1.tar.gz

About: Tardis is a system for making encrypted, incremental backups of filesystems.

RemoteDB.py  (Tardis-1.1.5):RemoteDB.py  (Tardis-1.2.1)
skipping to change at line 257 skipping to change at line 257
@reconnect @reconnect
def getFileInfoByInode(self, node, current=True): def getFileInfoByInode(self, node, current=True):
bset = self._bset(current) bset = self._bset(current)
(inode, device) = node (inode, device) = node
r = self.session.get(self.baseURL + "getFileInfoByInode/" + bset + "/" + str(device) + "/" + str(inode), headers=self.headers) r = self.session.get(self.baseURL + "getFileInfoByInode/" + bset + "/" + str(device) + "/" + str(inode), headers=self.headers)
r.raise_for_status() r.raise_for_status()
return r.json() return r.json()
@reconnect @reconnect
def getFileInfoByChecksum(self, checksum, current=False):
bset = self._bset(current)
r = self.session.get(self.baseURL + "getFileInfoByChecksum/" + bset + "/
" + str(checksum), headers=self.headers)
r.raise_for_status()
return r.json()
@reconnect
def getFileInfoByPath(self, path, current=False): def getFileInfoByPath(self, path, current=False):
bset = self._bset(current) bset = self._bset(current)
if not path.startswith('/'): if not path.startswith('/'):
path = '/' + path path = '/' + path
path = urllib.parse.quote(path, '/') path = urllib.parse.quote(path, '/')
r = self.session.get(self.baseURL + "getFileInfoByPath/" + bset + path, headers=self.headers) r = self.session.get(self.baseURL + "getFileInfoByPath/" + bset + path, headers=self.headers)
r.raise_for_status() r.raise_for_status()
return r.json() return r.json()
@reconnect @reconnect
skipping to change at line 456 skipping to change at line 463
r.raise_for_status() r.raise_for_status()
return r.json() return r.json()
@reconnect @reconnect
def listOrphanChecksums(self, isFile): def listOrphanChecksums(self, isFile):
r = self.session.get(self.baseURL + 'listOrphanChecksums/' + str(int(isF ile)), headers=self.headers) r = self.session.get(self.baseURL + 'listOrphanChecksums/' + str(int(isF ile)), headers=self.headers)
r.raise_for_status() r.raise_for_status()
return r.json() return r.json()
@reconnect @reconnect
def open(self, checksum, mode): def open(self, checksum, mode, streaming=True):
temp = tempfile.SpooledTemporaryFile(max_size=64 * 1024) if mode[0] != 'r':
raise PermissionError("Read only file system")
r = self.session.get(self.baseURL + "getFileData/" + checksum, stream=Tr ue) r = self.session.get(self.baseURL + "getFileData/" + checksum, stream=Tr ue)
r.raise_for_status() r.raise_for_status()
#self.logger.debug("%s", str(r.headers)) #self.logger.debug("%s", str(r.headers))
for chunk in r.iter_content(chunk_size=64 * 1024): if streaming:
temp.write(chunk) return r.raw
else:
temp = tempfile.SpooledTemporaryFile(max_size=1024 * 1024)
for chunk in r.iter_content(chunk_size=1024 * 1024):
temp.write(chunk)
temp.seek(0) temp.seek(0)
return temp return temp
@reconnect @reconnect
def removeOrphans(self): def removeOrphans(self):
r = self.session.get(self.baseURL + "removeOrphans", verify=self.verify, headers=self.headers) r = self.session.get(self.baseURL + "removeOrphans", verify=self.verify, headers=self.headers)
r.raise_for_status() r.raise_for_status()
return r.json() return r.json()
 End of changes. 4 change blocks. 
6 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)