type txPending … type pidSet … type freelist … // newFreelist returns an empty, initialized freelist. func newFreelist(freelistType FreelistType) *freelist { … } // size returns the size of the page after serialization. func (f *freelist) size() int { … } // count returns count of pages on the freelist func (f *freelist) count() int { … } // arrayFreeCount returns count of free pages(array version) func (f *freelist) arrayFreeCount() int { … } // pending_count returns count of pending pages func (f *freelist) pending_count() int { … } // copyall copies a list of all free ids and all pending ids in one sorted list. // f.count returns the minimum length required for dst. func (f *freelist) copyall(dst []pgid) { … } // arrayAllocate returns the starting page id of a contiguous list of pages of a given size. // If a contiguous block cannot be found then 0 is returned. func (f *freelist) arrayAllocate(txid txid, n int) pgid { … } // free releases a page and its overflow for a given transaction id. // If the page is already free then a panic will occur. func (f *freelist) free(txid txid, p *page) { … } // release moves all page ids for a transaction id (or older) to the freelist. func (f *freelist) release(txid txid) { … } // releaseRange moves pending pages allocated within an extent [begin,end] to the free list. func (f *freelist) releaseRange(begin, end txid) { … } // rollback removes the pages from a given pending tx. func (f *freelist) rollback(txid txid) { … } // freed returns whether a given page is in the free list. func (f *freelist) freed(pgId pgid) bool { … } // read initializes the freelist from a freelist page. func (f *freelist) read(p *page) { … } // arrayReadIDs initializes the freelist from a given list of ids. func (f *freelist) arrayReadIDs(ids []pgid) { … } func (f *freelist) arrayGetFreePageIDs() []pgid { … } // write writes the page ids onto a freelist page. All free and pending ids are // saved to disk since in the event of a program crash, all pending ids will // become free. func (f *freelist) write(p *page) error { … } // reload reads the freelist from a page and filters out pending items. func (f *freelist) reload(p *page) { … } // noSyncReload reads the freelist from pgids and filters out pending items. func (f *freelist) noSyncReload(pgids []pgid) { … } // reindex rebuilds the free cache based on available and pending free lists. func (f *freelist) reindex() { … } // arrayMergeSpans try to merge list of pages(represented by pgids) with existing spans but using array func (f *freelist) arrayMergeSpans(ids pgids) { … }