In the near future, I’m planning on migrating the dataMine database from the current flat file structure, to a more tiered structure. The flat structure seemed like a good idea a couple of years ago, but I now have just under 3000 files in my database, and in a single directory, that’s trouble! Even doing a simple directory listing takes a significant amount of time, and WinSCP hangs for nearly a minute now when doing a directory!
The next step after this is to add the history file generation into the mix. This will generate more stats, and hence, more files. So, the 3000 files will quickly increase. For most people, the change in the database won’t matter - the plugin will sort it all out, and if anything, things might be a little quicker (probably not noticeable though).
However, if you are doing anything “non-standard” with the dataMine data - ie accessing the files directly - then your scripts will stop working. Likewise, backup solutions may not work as the files will be in a different place. So, I thought I’d give everyone plenty of notice that I’m going to do this, and also give a heads up on what I’m planning!
The new structure will be as follows -:
/dataMine/database/ID/TYPE/ENTRY.txt
In the /dataMine directory, there will just be a few files - the dataMine Config.json files, their backups, notifications, and sunriseSunset times.
A database sub directory will contain separate directories for each logged datapoint. This is the ID field above - it’s just an internal reference number that dataMine uses (if you look at the current files, it’s the number on the beginning of the filenames).
In the ID directory will be a number of other directories for different types of data - eg raw data, and different types of historical data. The same files format will be used as is currently used now (basically a CSV file), but the filenames will just be a number, not the long filenames we have now.
This means that each directory will only have a “few hundred” files - no more than one file per week. This makes directory listings, and file manipulation much faster.
I’m open to suggestions if advanced users have any comments on the structure, otherwise this will be rolled out some time in the future (in a few weeks) - I might try and release a beta version first if anyone fancies testing it. I’ve already implemented the changes and the conversion will be done automatically by the plugin, so again, most users won’t really notice any major difference.
Any comments, let me know.
Cheers
Chris