What are record numbers? They are just the records position in a file right.
so when a record gets marked as deletes (say record 5) do all the following recods move down one spot? (record 6 becomes 5). Then when a new record is added and gets written to the spot the last was deleted, is the new record number 5?
Is it ok to have a collections of type record? A record object just holds strings of all the fields. When the data file is opened I have it filling up the Collection with all the records. Then read just spits out the correct one. Update() updates the Collection and the file
I have interpreted just as you that the record number is just the position of the record in the file. I also count deleted records, so if a record is deleted, it keeps the same number.*
For example, the database could have the following contents:
0 - record A 1 - record B 2 - record C [deleted] 3 - record D
If a clients attempts to read or lock record 2, the server throws a RecordNotFoundException.
* I think this has to be. Imagine in my example if one client attempts to access record #3, just after another client deletes record #1. Then record #3 would have been renumbered to #2 and the first client would get an exception. Not quite a practical approach!