tmp
This commit is contained in:
62
atree/io.go
62
atree/io.go
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user