From 2a82c6f28e6c69bb79fdd35d5fab25cd4b852bea Mon Sep 17 00:00:00 2001 From: Rosnec Date: Fri, 2 May 2014 19:19:45 -0400 Subject: [PATCH] some plans --- doc/planning.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/planning.md b/doc/planning.md index 5a0f26c..d09136e 100644 --- a/doc/planning.md +++ b/doc/planning.md @@ -48,3 +48,20 @@ Planning - Possible pitfalls when I want to make major changes to word-scraper, because I'll have to change two projects. So it is probably best to work mainly on b-plus-tree + +# May 2, 2014 + +## Delayed Persistence +- Instead of writing each node to disc each time one is altered, have + a hash-map, mapping RAF offsets to nodes which have already been + read and/or altered +- Whenever a node needs to be read off the disc, first check if its + offset is already in the hash-map, and use the in-memory node + instead if one exists +- Instead of simply using `assoc` to add new nodes to the map, write a + function which checks the number of elements in the map, and if it + reaches a certain threshold (a parameter to the function), write + half of the nodes at random to disc, and `dissoc` them from the map + after they've been written +- When all operations are finished, write the entire hash-map to disc, + and let it be garbage-collected