[darcs-devel] [issue1556] task: abandon tentative files and keep the information in memory

Ben Franksen bugs at darcs.net
Sat Jul 21 15:06:33 UTC 2018


Ben Franksen <ben.franksen at online.de> added the comment:

Looking at the code for writeTentativeInventory reveals that we already
store the _darcs/hashed_inventory (minus the pristine hash) inside
_darcs/inventories in standard hashed format. Thus we could compress
_darcs/hashed_inventory to a file that contains only the pristine and
inventory hash as e.g. _darcs/current_state. Reading this file, caching
the two hashes in the Repository token, and updating it whenever the
repo is modified would be cheap and could be done for each command. We
should be careful to write the parser for this file in a way that allows
future extensions of the format, e.g. for when we add versions or branches.

We must continue to write hashed_inventory, though, to remain compatible
with previous versions of Darcs. So here is my revised plan:

* always read current_state and pending once
* never write tentative_hashed_inventory, tentative_pristine, and
pending.tentative, instead keep them in memory as members of Repository
* on finalization, write hashed_inventory, pending, and current_state
each atomically by first writing to a temporary name and then renaming
(like we  already do for pending)

----------
title: task: safety refactor to ensure that hashed_inventory is only read once -> task: abandon tentative files and keep the information in memory

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue1556>
__________________________________


More information about the darcs-devel mailing list