From 15b2bef41569c846a8a8209b1b840e75595e24f0 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Tue, 15 Jan 2019 23:55:32 +0100 Subject: add interface --- internal/hash/hash.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ internal/hash/hash_def.go | 5 ----- 2 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 internal/hash/hash.go (limited to 'internal/hash') diff --git a/internal/hash/hash.go b/internal/hash/hash.go new file mode 100644 index 0000000..4a718be --- /dev/null +++ b/internal/hash/hash.go @@ -0,0 +1,44 @@ +package hash + +import "os" + +const ( + Magic = 0x061561 + Version = 2 +) + +type Hash struct { + file *os.File +} + +func New(file *os.File) *Hash { + return &Hash{file: file} +} + +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") +} diff --git a/internal/hash/hash_def.go b/internal/hash/hash_def.go index c159e78..f84edeb 100644 --- a/internal/hash/hash_def.go +++ b/internal/hash/hash_def.go @@ -76,8 +76,3 @@ type HashHdr struct { Spares [nCached]int32 // spare pages for overflow Bitmaps [nCached]uint16 // address of overflow page bitmaps } - -const ( - hashMagic = 0x061561 - hashVersion = 2 -) -- cgit v1.2.3