| 17 | } |
| 18 | |
| 19 | type Interface interface { |
| 20 | ReadWriter |
| 21 | |
| 22 | // Init initializes this freelist with the given list of pages. |
| 23 | Init(ids common.Pgids) |
| 24 | |
| 25 | // Allocate tries to allocate the given number of contiguous pages |
| 26 | // from the free list pages. It returns the starting page ID if |
| 27 | // available; otherwise, it returns 0. |
| 28 | Allocate(txid common.Txid, numPages int) common.Pgid |
| 29 | |
| 30 | // Count returns the number of free and pending pages. |
| 31 | Count() int |
| 32 | |
| 33 | // FreeCount returns the number of free pages. |
| 34 | FreeCount() int |
| 35 | |
| 36 | // PendingCount returns the number of pending pages. |
| 37 | PendingCount() int |
| 38 | |
| 39 | // AddReadonlyTXID adds a given read-only transaction id for pending page tracking. |
| 40 | AddReadonlyTXID(txid common.Txid) |
| 41 | |
| 42 | // RemoveReadonlyTXID removes a given read-only transaction id for pending page tracking. |
| 43 | RemoveReadonlyTXID(txid common.Txid) |
| 44 | |
| 45 | // ReleasePendingPages releases any pages associated with closed read-only transactions. |
| 46 | ReleasePendingPages() |
| 47 | |
| 48 | // Free releases a page and its overflow for a given transaction id. |
| 49 | // If the page is already free or is one of the meta pages, then a panic will occur. |
| 50 | Free(txId common.Txid, p *common.Page) |
| 51 | |
| 52 | // Freed returns whether a given page is in the free list. |
| 53 | Freed(pgId common.Pgid) bool |
| 54 | |
| 55 | // Rollback removes the pages from a given pending tx. |
| 56 | Rollback(txId common.Txid) |
| 57 | |
| 58 | // Copyall copies a list of all free ids and all pending ids in one sorted list. |
| 59 | // f.count returns the minimum length required for dst. |
| 60 | Copyall(dst []common.Pgid) |
| 61 | |
| 62 | // Reload reads the freelist from a page and filters out pending items. |
| 63 | Reload(p *common.Page) |
| 64 | |
| 65 | // NoSyncReload reads the freelist from Pgids and filters out pending items. |
| 66 | NoSyncReload(pgIds common.Pgids) |
| 67 | |
| 68 | // freePageIds returns the IDs of all free pages. Returns an empty slice if no free pages are available. |
| 69 | freePageIds() common.Pgids |
| 70 | |
| 71 | // pendingPageIds returns all pending pages by transaction id. |
| 72 | pendingPageIds() map[common.Txid]*txPending |
| 73 | |
| 74 | // release moves all page ids for a transaction id (or older) to the freelist. |
| 75 | release(txId common.Txid) |
| 76 |
no outgoing calls
no test coverage detected