Core

This article describes the format Core should follow

Description

As previously stated, Core acts as a system daemon and controls pFS on an application level. Therefore, core has the following aspects:

  • __init__()

    • This constructor initializes the config YAML dictionary

    • This constructor initializes the logger , state variables

    • This constructor initializes all the submodules regardless of order

    • This constructor populates the dependencies of all the submodules regardless of order

    • This constructor initializes the processes dictionary

  • start()

    • This start method runs through the Startup process

      • Read more about Startup here

    • This start method iterates through the processes dictionary and starts all threads

Specifics

The following methods are specific to just core:

  • populate_dependencies

    • Since the dependency tree for submodules is extremely circular, it is impossible to instantiate submodules with references to their dependencies

    • populate_dependencies iterates through the config dictionary and reads the depeneds_on key for each submodule. It then calls the submodule.set_modules method which populates the self.modules dictionary with references to the submodules dependencies

  • request

    • For any reason, a submodule may request a reference to another submodule. This method grants that request

  • get_state

    • Returns the current Mode.

  • reset_module

    • Handles the ModuleNotFoundError by directly accessing a submodules self.modules dictionary and repopulating it with good dependency references.

  • get_config

    • Returns core.config

Code

Last updated

Was this helpful?