Skaginn3x / framework

https://skaginn3x.github.io/framework/
MIT License
7 stars 4 forks source link

confman log configuration changes #12

Open jbbjarnason opened 1 year ago

jbbjarnason commented 1 year ago
omarhogni commented 1 year ago

Points 2 & 3 addressed already. Issue updated to reflect that.

jbbjarnason commented 1 year ago

We could fix the disk writing problem in parallel. And maybe skip the part of logging, my suggestion would be to keep 10 copies of old config.

  1. Write to file function would create file <config_name>.json.tmp
  2. rm file 10
  3. mv files 1-9 to 2-10 (`.json.1) etc
  4. cp file <config_name>.json to <config_name>.json.1
  5. mv file <config_name>.json.tmp to <config_name>.json

The tmp file could be used as lock file, if we would like to detect failure in this process.

Lastly 10 could be default but this could be an argument or change-able parameter in confman API.

For frontend, populate a list of timestamp of those 10 files. Frontend can call a method with argument integer with indices of the timestamp to fetch and compare in UI.

omarhogni commented 1 year ago

I think this is allot of work. Can we wait with removing config and when writing a new config just write the old as well timestamped?

omarhogni commented 1 year ago

Idea proposed in #218

omarhogni commented 1 year ago

@magni-mar Can you implement the configuration retention?

magni-mar commented 1 year ago

I can start working on this issue, can not promise any deadline though as I have no idea how long this will take.