aboutsummaryrefslogtreecommitdiff
path: root/hash/hash.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <sokolyuk@gmail.com>2021-11-22 13:48:19 +0100
committerDimitri Sokolyuk <sokolyuk@gmail.com>2021-11-22 13:48:19 +0100
commit1f1942ec0a4e55b3488a1771475994253bfe9b9e (patch)
tree0963f3b306cf5fdb7846c88102a18c462d096387 /hash/hash.go
parent172fe8ad99288d4a4976089955a75bd28f5da764 (diff)
Move
Diffstat (limited to 'hash/hash.go')
-rw-r--r--hash/hash.go52
1 files changed, 52 insertions, 0 deletions
diff --git a/hash/hash.go b/hash/hash.go
new file mode 100644
index 0000000..861dd90
--- /dev/null
+++ b/hash/hash.go
@@ -0,0 +1,52 @@
+package hash
+
+import "os"
+
+const (
+ Magic = 0x061561
+ Version = 2
+)
+
+type Hash struct {
+ file *os.File
+ BSize uint // hash table bucket size
+ FFactor uint // desired density within the hash table
+ CacheSize uint // suggested maximum size in bytes
+ LOrder uint // byte order for integers in metadata
+ Hash func([]byte) uint32 // user defined hash function
+}
+
+func New(file *os.File) *Hash {
+ return &Hash{
+ file: file,
+ Hash: defaultHash,
+ }
+}
+
+func (h *Hash) Close() error {
+ return h.file.Close()
+}
+
+func (h *Hash) Del(key []byte, flags uint) error {
+ panic("not implemented")
+}
+
+func (h *Hash) Fd() uintptr {
+ return h.file.Fd()
+}
+
+func (h *Hash) Get(key []byte, flags uint) ([]byte, error) {
+ panic("not implemented")
+}
+
+func (h *Hash) Put(key []byte, data []byte, flags uint) error {
+ panic("not implemented")
+}
+
+func (h *Hash) Sync(flags uint) error {
+ panic("not implemented")
+}
+
+func (h *Hash) Seq(key []byte, flags uint) ([]byte, error) {
+ panic("not implemented")
+}