Documentation
¶
Overview ¶
Package hash implements Hash type of Berkeley DB 1.85
Index ¶
- Constants
- func New(file *os.File) db.DB
- type Action
- type BufHead
- type HTab
- type Hash
- func (h *Hash) Close() (err error)
- func (h *Hash) Del(key []byte, flag uint) (err error)
- func (h *Hash) Fd() (fd uintptr)
- func (h *Hash) Get(key []byte, flag uint) (data []byte, err error)
- func (h *Hash) Put(key []byte, data []byte, flag uint) (err error)
- func (h *Hash) Seq(flag uint) (key []byte, data []byte, err error)
- func (h *Hash) Sync(flag uint) (err error)
- type HashHdr
- type Segment
Constants ¶
View Source
const ( BufMod = 1 << iota BufDisk BufBucket BufPin )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BufHead ¶
type HTab ¶
type HTab struct {
Hdr HashHdr // Header
NSegs int // Number of allocated segments
ExSegs int // Number of extra allocated
Hash func(interface{}, int64) uint32 // Hash function
Flags int // Flag values
FP int // File pointer
TmpBuf []byte // Temprory Buffer for BIG data
TmpKey []byte // Temprory Buffer for BIG keys
CPage BufHead // Currrent page
CBucket int // Current bucket
Err int // Error Number -- for DBM compatibility
NewFile int // Indicates if fd is backing store or not
SaveFile int // Indicates whether we need to flush file at exit
Mapp [nCached]uint32 // Pointers to page maps
NMaps int // Initial number of bitmaps
NBufs int // Number of buffers left to allocate
BufHead BufHead // Header of buffer lru list
Dir Segment // Hash Bucket directory
}
HTab is memroy resident data structure
type Hash ¶
type Hash struct {
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
// contains filtered or unexported fields
}
type HashHdr ¶
type HashHdr struct {
Magic int32 // Magic NO for hash tables
Version int32 // Version ID
LOrder uint32 // Byte Order
BSize int32 // Bucket/Page Size
BShift int32 // Bucket shift
DSize int32 // Directory Size
SSize int32 // Segment Size
SShift int32 // Segment shift
OvflPoint int32 // Where overflow pages are being allocated
LastFreed int32 // Last overflow page freed
MaxBucket int32 // ID of Maximum bucket in use
HighMask int32 // Mask to modulo into entire table
LowMask int32 // Mask to modulo into lower half of table
FFactor int32 // Fill factor
NKeys int32 // Number of keys in hash table
HdrPages int32 // Size of table header
HCharkey int32 // value of hash(CHARKEY)
Spares [nCached]int32 // spare pages for overflow
Bitmaps [nCached]uint16 // address of overflow page bitmaps
}
HashHdr holds hash table invormation
Source Files
¶
- def.go
- func.go
- hash.go
- log2.go
- page.go
Click to show internal directories.
Click to hide internal directories.