read initializes the node from a page.
(p *common.Page)
| 160 | |
| 161 | // read initializes the node from a page. |
| 162 | func (n *node) read(p *common.Page) { |
| 163 | n.pgid = p.Id() |
| 164 | n.isLeaf = p.IsLeafPage() |
| 165 | n.inodes = common.ReadInodeFromPage(p) |
| 166 | |
| 167 | // Save first key, so we can find the node in the parent when we spill. |
| 168 | if len(n.inodes) > 0 { |
| 169 | n.key = n.inodes[0].Key() |
| 170 | common.Assert(len(n.key) > 0, "read: zero-length node key") |
| 171 | } else { |
| 172 | n.key = nil |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | // write writes the items onto one or more pages. |
| 177 | // The page should have p.id (might be 0 for meta or bucket-inline page) and p.overflow set |