aboutsummaryrefslogtreecommitdiff
path: root/hash/hash.go
blob: 7865fa2f4b7f04a9b44e03b40167dfb32ba3ef75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Package hash implements Hash type of Berkeley DB 1.85
package hash

import (
	"os"

	"dim13.org/db"
)

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) db.DB {
	return &Hash{
		file: file,
		Hash: defaultHash,
	}
}

func (h *Hash) Close() (err error) {
	return h.file.Close()
}

func (h *Hash) Del(key []byte, flag uint) (err error) {
	panic("not implemented") // TODO: Implement
}

func (h *Hash) Fd() (fd uintptr) {
	return h.file.Fd()
}

func (h *Hash) Get(key []byte, flag uint) (data []byte, err error) {
	panic("not implemented") // TODO: Implement
}

func (h *Hash) Put(key []byte, data []byte, flag uint) (err error) {
	panic("not implemented") // TODO: Implement
}

func (h *Hash) Sync(flag uint) (err error) {
	panic("not implemented") // TODO: Implement
}

func (h *Hash) Seq(flag uint) (key []byte, data []byte, err error) {
	panic("not implemented") // TODO: Implement
}