(p *common.Page)
| 255 | } |
| 256 | |
| 257 | func (t *shared) Read(p *common.Page) { |
| 258 | if !p.IsFreelistPage() { |
| 259 | panic(fmt.Sprintf("invalid freelist page: %d, page type is %s", p.Id(), p.Typ())) |
| 260 | } |
| 261 | |
| 262 | ids := p.FreelistPageIds() |
| 263 | |
| 264 | // Copy the list of page ids from the freelist. |
| 265 | if len(ids) == 0 { |
| 266 | t.Init([]common.Pgid{}) |
| 267 | } else { |
| 268 | // copy the ids, so we don't modify on the freelist page directly |
| 269 | idsCopy := make([]common.Pgid, len(ids)) |
| 270 | copy(idsCopy, ids) |
| 271 | // Make sure they're sorted. |
| 272 | sort.Sort(common.Pgids(idsCopy)) |
| 273 | |
| 274 | t.Init(idsCopy) |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | func (t *shared) EstimatedWritePageSize() int { |
| 279 | n := t.Count() |
no test coverage detected