mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-28 12:34:53 +02:00
Rename update_configuration to build_configuration and return a standalone config.
This commit is contained in:
@@ -196,9 +196,18 @@ class ConfigurableInterface(validity.ValidityRoutines, metaclass = ABCMeta):
|
||||
def config(self):
|
||||
return self._context.config.branch(self._config_path)
|
||||
|
||||
@abstractmethod
|
||||
def update_configuration(self):
|
||||
"""Ensures that if the class has been created, its configuration is correct"""
|
||||
def build_configuration(self):
|
||||
"""Constructs a HierarchicalDictionary of all the options required to build this component in the current context.
|
||||
|
||||
Ensures that if the class has been created, it can be recreated using the configuration built
|
||||
Inheriting classes must override this to ensure any dependent classes update their configurations too
|
||||
"""
|
||||
result = HierarchicalDict()
|
||||
for req in self.get_requirements():
|
||||
value = getattr(self, "_" + req.name, req.default)
|
||||
if value is not None:
|
||||
result[req.name] = value
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def get_requirements(cls):
|
||||
|
||||
@@ -228,6 +228,18 @@ class TranslationLayerInterface(DataLayerInterface, metaclass = ABCMeta):
|
||||
for x in scanner(chunk, offset):
|
||||
yield x
|
||||
|
||||
def build_configuration(self):
|
||||
config = super().build_configuration()
|
||||
|
||||
# Translation Layers are constructable, and therefore require a class configuration variable
|
||||
config["class"] = self.__class__.__module__ + "." + self.__class__.__name__
|
||||
for req in self.get_requirements():
|
||||
if isinstance(req, configuration.TranslationLayerRequirement):
|
||||
layer = self.config.get(req.name, None)
|
||||
if layer is not None:
|
||||
config.splice(req.name, self.context.memory[layer].build_configuration())
|
||||
return config
|
||||
|
||||
|
||||
class Memory(validity.ValidityRoutines, collections.abc.Mapping):
|
||||
"""Container for multiple layers of data"""
|
||||
|
||||
Reference in New Issue
Block a user