Documentation ¶
Overview ¶
SmallData is a key/value hash list implementation that can be written/read from disk
Index ¶
- func BunkHashCode(k int) int
- func BunkHashString(s string) int
- type HashTable
- func (ht *HashTable) Dump()
- func (ht HashTable) Print()
- func (ht *HashTable) Remove(k string) error
- func (ht *HashTable) SearchForData(k int) *HashTableData
- func (ht *HashTable) SearchKey(k int) string
- func (ht *HashTable) SearchString(k string) string
- func (ht HashTable) Stats()
- func (ht *HashTable) StoreBytes(key []byte, value []byte) error
- func (ht *HashTable) StoreBytesWithTimeStamp(input []byte) (int, error)
- func (ht *HashTable) StoreString(key string, value string) error
- type HashTableData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BunkHashCode ¶
Types ¶
type HashTable ¶
type HashTable struct { Table []HashTableData CurrentEntries int MaxTableSize int FileName string }
HashTable is the data structure for the HashTable itself which holds the array of HashTableData, the current entry count, the max table size, and the dump file name
func NewTable ¶
NewTable returns a New HashTable that is the size of the given size * the size of a HashTable
func NewTableFromFile ¶
NewTable from file returns a New Hash table based on a dump file given it will be the size of the file. If the file cannot be found a clean table will be produced with the default size given.
func (*HashTable) Dump ¶
func (ht *HashTable) Dump()
Dump dumps the contents of the table into a file the name of the dump file is determined by the name given upon intialization of the hashtable
func (*HashTable) Remove ¶
Remove removes a value from the hash table by nulling the value and assigning a 0 to the key
func (*HashTable) SearchForData ¶
func (ht *HashTable) SearchForData(k int) *HashTableData
Search searchs for the HashTableData entry of the value of the given int key
func (*HashTable) SearchKey ¶
SearchString searchs for the string Value of the given string Hashed Key Int
func (*HashTable) SearchString ¶
SearchString searchs for the string Value of the given string Key
func (*HashTable) StoreBytes ¶
StoreBytes is the same as StoreString but use type []byte for the key and value
func (*HashTable) StoreBytesWithTimeStamp ¶
StoreBytesWithTimeStamp will use time of storage to create a hash key and will store the given byte array it will then return the hashed integer value for searching later on
type HashTableData ¶
HashTableData is the data structure that holds the basic Key/Value information of every entry