On Monday, 5 January 2015 20:44:14 UTC+2, Jason E. Aten wrote:
Thanks for the suggestions guys. I've simplified the exposed methods and added docs to them.
Also, there might be a better name for it - using the negation form of "not on the heap" is probably not that informative.
Is it necessary to have it as "offheap.HashTable" and not "offheap.Table"? I'm just thinking whether the "Hash" part adds any clarity to the code that uses it? To me it really doesn't add any useful information.
Also try to get rid of as much stutter as possible, e.g.
func (t *HashTable) DestroyHashTable()
-->
func (t *HashTable) Destroy()
Diagnostic stuff probably shouldn't be part of public API
func (*HashTable) Dump
That probably could be cleaned up or made clearer what it is... e.g. name it:
TableFile or something like that.
Similarly Malloc -> NewFileBackedTable() or NewFileTable()
For these don't add the suffixes, because the type already contains "ByteKey" it should be obvious that Insert/Delete/Lookup take "[]byte" as argument. (Similarly for the StringHashTable).
Rename that to something simple like "Key".
Rename that to something simple like "Value".
I would say put the Iterator constructor on the hashtable and not as a separate constructor.
If you intend some of the parameters be modified by the package user, make them constants e.g.
const (
KeySize = 64
CellSize = 128
)
and place them in a separate file - that way you can point to it in the documentation.