code-for-venezuela / c4v-py

3 stars 3 forks source link

Luis/persistency scheme #81

Closed LDiazN closed 3 years ago

LDiazN commented 3 years ago

Persistency Scheme

Problem Description

We need a way to persist data computed with out library in some persistent storage, and it should be flexible enough so the user can plug & play his custom persistency methods to store the data as he needs.

Proposed solution

Create a new base class for storage manager objects that can be easily overridden. We propose a class with common operations to perform over the stored data:

Also, we provide a json-based implementation for local storage and testing purposes.

Important changed:

How to test it

import JsonManager class:

from c4v.scraper.persistency_manager.json_storage_manager import JsonManager

Create an instance of such class

jman = JsonManager("path/to/json_file/in/your/computer.json")

use this object to test its corresponding methods

Relevant files:

Further work