Documentation ¶
Index ¶
- Constants
- func HashPageValueContent(db *os.File, pageData []byte, hashPageIndex uint16, pageSize uint32, ...) ([]byte, error)
- func HashPageValueIndexes(data []byte, entries uint16, swapped bool) ([]uint16, error)
- type BerkeleyDB
- type GenericMetadataPage
- type HashMetadata
- type HashMetadataPage
- type HashOffPageEntry
- type HashPage
- type PageType
Constants ¶
View Source
const ( NoEncryptionAlgorithm = 0 HashMagicNumber = 0x00061561 HashMagicNumberBE = 0x61150600 // the size (in bytes) of an in-page offset HashIndexEntrySize = 2 // all DB pages have the same sized header (in bytes) PageHeaderSize = 26 // all page types supported // https://github.com/berkeleydb/libdb/blob/v5.3.28/src/dbinc/db_page.h#L35-L53 HashUnsortedPageType PageType = 2 // Hash pages created pre 4.6. DEPRECATED OverflowPageType PageType = 7 HashMetadataPageType PageType = 8 HashPageType PageType = 13 // Sorted hash page. // https://github.com/berkeleydb/libdb/blob/v5.3.28/src/dbinc/db_page.h#L569-L573 HashOffIndexPageType PageType = 3 // aka HOFFPAGE HashOffPageSize = 12 // (in bytes) )
Variables ¶
This section is empty.
Functions ¶
func HashPageValueContent ¶
Types ¶
type BerkeleyDB ¶
type BerkeleyDB struct { HashMetadata *HashMetadataPage // contains filtered or unexported fields }
func Open ¶
func Open(path string) (*BerkeleyDB, error)
func (*BerkeleyDB) Close ¶
func (db *BerkeleyDB) Close() error
func (*BerkeleyDB) Read ¶
func (db *BerkeleyDB) Read() <-chan dbi.Entry
type GenericMetadataPage ¶
type GenericMetadataPage struct { LSN [8]byte `struct:"[8]byte"` /* 00-07: LSN. */ PageNo uint32 `struct:"uint32"` /* 08-11: Current page number. */ Magic uint32 `struct:"uint32"` /* 12-15: Magic number. */ Version uint32 `struct:"uint32"` /* 16-19: Version. */ PageSize uint32 `struct:"uint32"` /* 20-23: Pagesize. */ EncryptionAlg uint8 `struct:"uint8"` /* 24: Encryption algorithm. */ PageType uint8 `struct:"uint8"` /* 25: Page type. */ MetaFlags uint8 `struct:"uint8"` /* 26: Meta-only flags */ Unused1 uint8 `struct:"uint8"` /* 27: Unused. */ Free uint32 `struct:"uint32"` /* 28-31: Free list page number. */ LastPageNo uint32 `struct:"uint32"` /* 32-35: Page number of last page in db. */ NParts uint32 `struct:"uint32"` /* 36-39: Number of partitions. */ KeyCount uint32 `struct:"uint32"` /* 40-43: Cached key count. */ RecordCount uint32 `struct:"uint32"` /* 44-47: Cached record count. */ Flags uint32 `struct:"uint32"` /* 48-51: Flags: unique to each AM. */ UniqueFileID [19]byte `struct:"[19]byte"` /* 52-71: Unique file ID. */ }
func ParseGenericMetadataPage ¶
func ParseGenericMetadataPage(data []byte) (*GenericMetadataPage, error)
type HashMetadata ¶
type HashMetadata struct { GenericMetadataPage MaxBucket uint32 `struct:"uint32"` /* 72-75: ID of Maximum bucket in use */ HighMask uint32 `struct:"uint32"` /* 76-79: Modulo mask into table */ LowMask uint32 `struct:"uint32"` /* 80-83: Modulo mask into table lower half */ FillFactor uint32 `struct:"uint32"` /* 84-87: Fill factor */ NumKeys uint32 `struct:"uint32"` /* 88-91: Number of keys in hash table */ CharKeyHash uint32 `struct:"uint32"` /* 92-95: Value of hash(CHARKEY) */ }
type HashMetadataPage ¶
type HashMetadataPage struct { HashMetadata Swapped bool }
func ParseHashMetadataPage ¶
func ParseHashMetadataPage(data []byte) (*HashMetadataPage, error)
type HashOffPageEntry ¶
type HashOffPageEntry struct { PageType uint8 `struct:"uint8"` /* 0: Page type. */ Unused [3]byte `struct:"[3]byte"` /* 01-03: Padding, unused. */ PageNo uint32 `struct:"uint32"` /* 04-07: Offpage page number. */ Length uint32 `struct:"uint32"` /* 08-11: Total length of item. */ }
func ParseHashOffPageEntry ¶
func ParseHashOffPageEntry(data []byte, swapped bool) (*HashOffPageEntry, error)
type HashPage ¶
type HashPage struct { LSN [8]byte `struct:"[8]byte"` /* 00-07: LSN. */ PageNo uint32 `struct:"uint32"` /* 08-11: Current page number. */ PreviousPageNo uint32 `struct:"uint32"` /* 12-15: Previous page number. */ NextPageNo uint32 `struct:"uint32"` /* 16-19: Next page number. */ NumEntries uint16 `struct:"uint16"` /* 20-21: Number of items on the page. */ FreeAreaOffset uint16 `struct:"uint16"` /* 22-23: High free byte page offset. */ TreeLevel uint8 `struct:"uint8"` /* 24: Btree tree level. */ PageType uint8 `struct:"uint8"` /* 25: Page type. */ }
Click to show internal directories.
Click to hide internal directories.