Reuse removed space in database file #27
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
The index file contains a list of all valid blocks inside the database file. From this list, we can also derive a list of free blocks, which could be reused when writing new data to the database file. This would prevent the database file from growing indefinitely. This information can be tracked in-memory using e.g. a linked list.
For the idx file, we can use a similar but more simple approach, as the entries are of a constant length. We can simply overwrite entries with length 0 with new entries that are useful.