Documentation ¶
Overview ¶
Package hash implements a simple storage agnostic hash index for a key value store.
- no segmentation / compaction - implies that keys can and will appear multiple times, the most recent entry will reflect the actual state in the keys - uses single append only log (can grow boundlessly with no segmentation / compaction) - keeps entire keyset in an in-memory map (keys) - keys maps a keys hash to its corresponding log entry's location in the underlying paginated storage
Operations: - get - set - del - restore -> restore the keys map from the commit log
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHash ¶
DefaultHash is a HashFunc that uses the sha1 hashing algorithm
Types ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index is a hash index implementation
func NewIndex ¶
NewIndex accepts a variadic number of option funcs for configuration. It returns a configured Hash Index ready to start running operations.
type IndexOption ¶
type IndexOption func(*options)
IndexOption is func that modifies the index configuration options.
func SetHashFunc ¶
func SetHashFunc(hash KeyHashFunc) IndexOption
SetHashFunc overrides the Index default hashing func.
type KeyHashFunc ¶
KeyHashFunc is a hash func that takes a slice of bytes and returns a hash or an error