blue_hydra
blue_hydra copied to clipboard
Option for adjusting retention time for records in the DB
device.rb appears to automatically truncate data in the DB that is older than 2 weeks.
Can you add something to the README.md as to how this works?
Also, please consider adding an option to blue_hydra.yml file that can make this retention time adjustable. Or maybe just make a note in the README.md that this can be adjusted in device.rb.
Hail Blue Hydra.
so the db is cleaned of anything over than 2 weeks IF that is 5000 or more devices.
performance suffers DRASTICALLY above this point. I can make it configurable within a sane range.
What about anything between 1 device more than a day old, and 10000 and a month? with documentation explaining if you want the same db for more than a month you need to back it up yourself?
I mean I suppose I could allow it to be whatever the user wants, with heavy warnings if outside of sanity...
actually that's just the "fast delete" code, the full delete code removes anything from more than a week ago as well. I can adjust that as well, but I'd like to hear your thoughts
If you are going to auto delete the database because it's old, a user prompt for that action would be nice.
An option (or prompt like the above) to disable the "full delete code" would also be sweet. If I understand correctly, the default threshold for the "full delete code" is 1 week. Perhaps this could be an adjustable setting in days in blue_hydra.yml? If blue hydra is launched after a number of days has passed, then a prompt for deletion of the old data, per the above, would be nice. If a user says no, don't delete, then the db gets appended instead of reset to a fresh copy.
If the idea of user prompts is disgusting, then perhaps another default value with a default boolean setting can be added to blue_hydra.yml.
Something like:
auto_delete_old_db: true auto_delete_old_db_threshold_in_days: 7
These values would be for the "full delete" code. I am operating on the assumption that the "full delete" code checks for a timestamp of the database file and resets it if it's too old. That may be an incorrect assumption.
That said, you could make those thresholds adjustable also for the "fast delete" code (by time and number of records in the db), but with recommendations for the current defaults.
I'm thinking that whatever the user wants with warnings would be the way to go. If there are more than 5000 devices in the db, then give a warning that performance could be terrible.
Settings for the "fast delete" could also be added to blue_hydra.yml.
Something like:
auto_truncate_db_records: true auto_truncate_db_records_limit: 5000 #number of records auto_truncate_db_records_older_than: 14 #value in days
With the above example settings, I would love to have an adjustable option for "auto_truncate_db_records_older_than". It's going to take some people ages to reach 5000 records. When that day comes, I might not want to delete everything older than 2 weeks. I might want to delete everything older than 2 months, or whatever. It all depends on how busy an area is with detected devices.
For what its worth, I would prefer settings in the blue_hydra.yml file in lieu of any prompt for an end user.
Also, what do you think about a "memory only" option for the sqlite database? It appears that if this is desired, you only have to set the BLUE_HYDRA environment variable to "test" (as seen on line 382 in blue_hydra/lib/blue_hydra.rb). Can this get a mention in the main README.md file?
Just one guys opinions, and again, thanks for considering this (and let me know if I got something wrong).
Hail Blue Hydra!
the in memory db already exists, it's a command line option
--no-db Keep db in ram only
Has any progress been made towards implementing this feature?
Datamapper code still shows 5000 record limit.