()
| 283 | } |
| 284 | |
| 285 | func (tx *Tx) commitFreelist() error { |
| 286 | // Allocate new pages for the new free list. This will overestimate |
| 287 | // the size of the freelist but not underestimate the size (which would be bad). |
| 288 | p, err := tx.allocate((tx.db.freelist.EstimatedWritePageSize() / tx.db.pageSize) + 1) |
| 289 | if err != nil { |
| 290 | tx.rollback() |
| 291 | return err |
| 292 | } |
| 293 | |
| 294 | tx.db.freelist.Write(p) |
| 295 | tx.meta.SetFreelist(p.Id()) |
| 296 | |
| 297 | return nil |
| 298 | } |
| 299 | |
| 300 | // Rollback closes the transaction and ignores all previous updates. Read-only |
| 301 | // transactions must be rolled back and not committed. |
no test coverage detected