Merge branch 'master' of github.com:volatilityfoundation/volatility3

This commit is contained in:
Mike Auty
2015-02-23 00:02:33 +00:00
3 changed files with 13 additions and 0 deletions
@@ -52,6 +52,14 @@ class DataLayerInterface(validity.ValidityRoutines, metaclass = ABCMeta):
Note: Writes are not atomic, therefore some data can be written, even if an exception is thrown.
"""
def destroy(self):
"""Allows DataLayers to close any open handles, etc.
Systems that make use of Data Layers should called destroy when they are done with them.
This will close all handles, and make the object unreadable
(exceptions will be thrown using a DataLayer after destruction)"""
pass
class TranslationLayerInterface(DataLayerInterface, metaclass = ABCMeta):
@abstractmethod
+1
View File
@@ -50,6 +50,7 @@ class Memory(validity.ValidityRoutines):
if depend_list:
raise exceptions.LayerException("Layer " + layer.name +
" is depended upon by " + ", ".join(depend_list))
self._layers[name].destroy()
del self._layers[name]
def __getitem__(self, name):
+4
View File
@@ -93,3 +93,7 @@ class FileLayer(interfaces.layers.DataLayerInterface):
raise exceptions.InvalidAddressException("Data segment outside of the " + self.name + " file boundaries")
self._file.seek(offset)
self._file.write(data)
def destroy(self):
"""Closes the file handle"""
self._file.close()