diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-27 10:11:54 -0500 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-27 10:11:54 -0500 |
commit | 192649f453af1f1fa79f41f1cfeed296ec51b545 (patch) | |
tree | 1195cb6ca23a6c8a576a8c24d10295ddc1515df6 /page.go | |
parent | Initialize transaction/rwtransaction. (diff) | |
download | dedo-192649f453af1f1fa79f41f1cfeed296ec51b545.tar.gz dedo-192649f453af1f1fa79f41f1cfeed296ec51b545.tar.xz |
Intermediate.
Diffstat (limited to 'page.go')
-rw-r--r-- | page.go | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -4,12 +4,11 @@ import ( "unsafe" ) -const maxPageSize = 0x8000 -const minKeyCount = 2 - -const pageHeaderSize = int(unsafe.Offsetof(((*page)(nil)).data)) +const pageHeaderSize = int(unsafe.Offsetof(((*page)(nil)).ptr)) -const minPageKeys = 2 +const maxPageSize = 0x8000 +const minKeysPerPage = 2 +const maxNodesPerPage = 65535 const fillThreshold = 250 // 25% const ( @@ -21,12 +20,11 @@ const ( type pgid uint64 type page struct { - id pgid - flags uint32 - lower uint16 - upper uint16 - count uint32 - data uintptr + id pgid + flags uint16 + count uint16 + overflow uint32 + ptr uintptr } // meta returns a pointer to the metadata section of the page. @@ -52,5 +50,10 @@ func (p *page) init(pageSize int) { m.version = version m.pageSize = uint32(pageSize) m.pgid = 1 - m.buckets.root = 0 + m.sys.root = 0 +} + +// lnode retrieves the leaf node by index +func (p *page) lnode(index int) *lnode { + return &((*[maxNodesPerPage]lnode)(unsafe.Pointer(&p.ptr)))[index] } |