Hi Kris,
I have the Bodgitt and Scarper assignment and my instructions specify that each record has the following flag:
2 byte flag. 00 implies valid record, 0x8000 implies deleted record
.
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.
Frans.
* 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!