Have you looked into server less databases, maybe something like SQLite (http://sqlite.org/)?
Using something like that may be more efficient then using just files and you can name these files whatever you want.
Edit Reason: Typo fixed
“The strongest of all warriors are these two — Time and Patience.” ― Leo Tolstoy, War and Peace
In order for us to suggest useful alternatives it would help us to know what in your requirements disallows SQLite. I'm still leaning towards a random access file but perhaps the issue that causes you to reject SQLite will also eliminate a random access file.
What kind of data will need to be written? Does every widget have the same field(s)? Do you have a DAO class that represents a widget's record? Can all the widgets make use of one DAO class? Once the data is written to a file, how will it be accessed? How often? Concurrently with writing?
Norm Radder wrote:More clarification on the requirements:
keep the last 5 status results of a widget
Does that say there is a circular queue or list that holds the last 5 result packets. Each result packet can have from 5 to 15 lines.
Each result packet can have up to 15 items (app1 - app15).
Each item has a "status" in order from oldest to most current and it will keep up to 5. Once you reach 5, the oldest status will be bumped off.
posted 1 year ago
What is the max size in bytes of the largest result packet?
My objective it to allocate a fixed size slot in a random access file for each packet for each widget and have a pointer to key points in that slot to keep from having to move bytes around.
If 2000*maxSlotSize is reasonable
The requirements in your original post don't leave any wiggle room to suggest alternatives.
Writing one file per widget is inefficient. Could you have a new file every 10 minutes whose file name is the timestamp? Write all widget data for that 10 minute interval to a single file and then delete files older than some older timestamp.
if the status of such a widget has not changed in the last 10 minutes, must you still update the file?
And must you update the (changed?) files every 10 minutes, or can you keep them in memory and do the writes only once in every, say, hour?
There are three kinds of actuaries: those who can count, and those who can't.