Skip to content

ReplacingThePersistenceSystem

Amy Bowersox edited this page May 14, 2020 · 3 revisions

Replacing The Persistence System

The built-in persistence system used by the Binary Analysis Toolkit employs a SQLite database to store information about previously-analyzed items and data collated for reports. You may wish to employ a different method for storing that data, such as a full SQL or NoSQL database. To do this, you would write a new persistor that is loadable by the persistence framework in the toolkit code.

Implementing a New Persistor

You will have to implement two object classes in Python:

  • The persistor object, which will be called to store and retrieve data from the database or other data storage environment.
  • The persistor factory object, which will be called at toolkit startup to load your persistor object and configure it for use.

These object classes should be placed somewhere that the Binary Analysis Toolkit code can find them, for example, on the PYTHONPATH.

The default persistor employs SQLite to store the managed state information.

Configuring the Persistor

All configuration information for your persistor should be located in the database: section of the configuration file. Your persistor may make free use of any property name under this section, except for any property names beginning with an underscore character.

The special property name _provider: under the database: section should contain the fully-qualified class name of your persistor factory object, which the engine manager code will load and then call to create your persistor object.

As part of the creation process, your persistor factory object will be passed a Config object, which will point to the database: section of the configuration file. You can use the methods of this object to read any of the configuration properties you have defined.