Wednesday, May 27, 2009

Deadwood roadmap

My next phase of Deadwood development consists of some significant under-the-hood changes to the code that handles "dictionary" variables. Right now, the code is a simple list that doesn't scale; indeed, upstream_servers can only have a maximum of 96 elements.

My plan is to take the hashing code used for Deadwood's cache, and adapt it to be usable for the simpler cache used for upstream_servers and other dictionary variables:
  • This is a variable sized dictionary, not a fixed-sized cache. This in mind, I need to add the ability to grow the dictionary as more elements are added to it, and not use any code that removes elements as the cache fills up.
  • There is no ability to remove elements from the hash, just add elements
  • Hash entries do not expire; once an entry is in the hash, it stays in the hash
The fact of the matter is that I'm hitting the point where I would be better off writing this in C++ instead of just regular C; in C++ I could make a generic hash an abstract class, then add the methods to make the dynamic "dictionary" used for things like upstream_servers as one derived class, and the methods to remove elements when the cache is full and what not as another different, but similar derived class.