Cleanup, no logic changes.
This commit is contained in:
parent
c2a1a7f247
commit
b251368b09
@ -13,13 +13,13 @@ type Index struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewIndex(f *File) (*Index, error) {
|
func NewIndex(f *File) (*Index, error) {
|
||||||
maxPage, err := f.maxPage()
|
firstPage, err := f.pageCount()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
idx := &Index{
|
idx := &Index{
|
||||||
fList: newFreeList(maxPage),
|
fList: newFreeList(firstPage),
|
||||||
aList: *newAllocList(),
|
aList: *newAllocList(),
|
||||||
seen: map[[2]uint64]struct{}{},
|
seen: map[[2]uint64]struct{}{},
|
||||||
mask: []bool{},
|
mask: []bool{},
|
||||||
|
@ -134,7 +134,7 @@ func (pf *File) writePage(page dataPage, id uint64) error {
|
|||||||
// Reading
|
// Reading
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
func (pf *File) maxPage() (uint64, error) {
|
func (pf *File) pageCount() (uint64, error) {
|
||||||
fi, err := pf.f.Stat()
|
fi, err := pf.f.Stat()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, errs.IO.WithErr(err)
|
return 0, errs.IO.WithErr(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user