This commit is contained in:
2026-05-31 20:01:28 +00:00
parent e7ec6083cb
commit db5ecd3dfd
28 changed files with 2090 additions and 2155 deletions

View File

@@ -13,11 +13,11 @@ import (
)
// fix - додати ID, щоб потім перемістити із тимчасового буфера в pages, або звільнити
type AllocatedPage struct {
PageNo uint32
Data []byte
IsReused bool
}
// type AllocatedPage struct {
// PageNo uint32
// Data []byte
// IsReused bool
// }
type readResult struct {
Data []byte
@@ -110,33 +110,33 @@ func (s *Atree) allocPageNumber() (uint32, bool) {
return 0, true
}
func (s *Atree) allocPage() AllocatedPage {
var (
allocated = AllocatedPage{
Data: make([]byte, PageSize),
}
)
//allocated.PageNo = s.freelist.ReservePage()
s.mutex.Lock()
// if allocated.PageNo > 0 {
// allocated.IsReused = true
// } else {
// if s.allocatedPagesQty == math.MaxUint32 {
// qb.Abort(qb.MaxAtreeSizeExceeded, errors.New("no space in Atree index"))
// }
// s.allocatedPagesQty++
// allocated.PageNo = s.allocatedPagesQty
// }
// func (s *Atree) allocPage() AllocatedPage {
// var (
// allocated = AllocatedPage{
// Data: make([]byte, PageSize),
// }
// )
// //allocated.PageNo = s.freelist.ReservePage()
// s.mutex.Lock()
// // if allocated.PageNo > 0 {
// // allocated.IsReused = true
// // } else {
// // if s.allocatedPagesQty == math.MaxUint32 {
// // qb.Abort(qb.MaxAtreeSizeExceeded, errors.New("no space in Atree index"))
// // }
// // s.allocatedPagesQty++
// // allocated.PageNo = s.allocatedPagesQty
// // }
// s.pages[allocated.PageNo] = &_page{
// // fix pageType
// PageNo: allocated.PageNo,
// Buf: allocated.Data,
// ReferenceCount: 1,
// }
s.mutex.Unlock()
return allocated
}
// // s.pages[allocated.PageNo] = &_page{
// // // fix pageType
// // PageNo: allocated.PageNo,
// // Buf: allocated.Data,
// // ReferenceCount: 1,
// // }
// s.mutex.Unlock()
// return allocated
// }
// // fix - без freelist
// func (s *Atree) allocIndexPage() AllocatedPage {