page

package
v0.0.0-...-0601960 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const BlockArraySize = 4 * common.PageSize / (4*sizeOfHashTablePair + 1)
View Source
const OffsetLSN = 4
View Source
const OffsetPageStart = 0
View Source
const SizePageHeader = 8

PageSize is the size of a page in disk (4KB) const PageSize = 4096

Variables

This section is empty.

Functions

This section is empty.

Types

type HashTableBlockPage

type HashTableBlockPage struct {
	// contains filtered or unexported fields
}

*

  • Store indexed key and value together within block page. Supports
  • non-unique keys. *
  • Block page format (keys are stored in order):
  • ----------------------------------------------------------------
  • | KEY(1) + VALUE(1) | KEY(2) + VALUE(2) | ... | KEY(n) + VALUE(n)
  • ---------------------------------------------------------------- *
  • Here '+' means concatenation. *

func (*HashTableBlockPage) Insert

func (page *HashTableBlockPage) Insert(index uint64, key uint64, value uint64) bool

Attempts to insert a key and value into an index in the baccess.

func (*HashTableBlockPage) IsOccupied

func (page *HashTableBlockPage) IsOccupied(index uint64) bool

Returns whether or not an index is occuppied (valid key/value pair)

func (*HashTableBlockPage) IsReadable

func (page *HashTableBlockPage) IsReadable(index uint64) bool

Returns whether or not an index is readable (valid key/value pair)

func (*HashTableBlockPage) KeyAt

func (page *HashTableBlockPage) KeyAt(index uint64) uint64

Gets the key at an index in the block

func (*HashTableBlockPage) Remove

func (page *HashTableBlockPage) Remove(index uint64)

func (*HashTableBlockPage) ValueAt

func (page *HashTableBlockPage) ValueAt(index uint64) uint64

Gets the value at an index in the block

type HashTableHeaderPage

type HashTableHeaderPage struct {
	// contains filtered or unexported fields
}

*

*
* Header Page for linear probing hash table.
*
* Header format (size in byte, 12 bytes in total):
* ----------------------------------------------------------------------
* |  PageId(4) | NextBlockIndex(4) | Size (4) | BlockPageIds (4) x 1020
* ----------------------------------------------------------------------
* all Page content size: 12 + 8 * 1020 = 4096

func (*HashTableHeaderPage) AddBlockPageId

func (page *HashTableHeaderPage) AddBlockPageId(pageId types.PageID)

func (*HashTableHeaderPage) GetBlockPageId

func (page *HashTableHeaderPage) GetBlockPageId(index uint64) types.PageID

func (*HashTableHeaderPage) GetPageId

func (page *HashTableHeaderPage) GetPageId() types.PageID

func (*HashTableHeaderPage) GetSize

func (page *HashTableHeaderPage) GetSize() int

func (*HashTableHeaderPage) NumBlocks

func (page *HashTableHeaderPage) NumBlocks() uint64

func (*HashTableHeaderPage) SetPageId

func (page *HashTableHeaderPage) SetPageId(pageId types.PageID)

func (*HashTableHeaderPage) SetSize

func (page *HashTableHeaderPage) SetSize(size int)

type HashTablePair

type HashTablePair struct {
	// contains filtered or unexported fields
}

type Page

type Page struct {

	// for debug
	WLatchMap      map[int32]bool
	RLatchMap      map[int32]bool
	RLatchMapMutex *sync.Mutex
	// contains filtered or unexported fields
}

Page represents an abstract page on disk

func New

func New(id types.PageID, isDirty bool, data *[common.PageSize]byte) *Page

New creates a new page

func NewEmpty

func NewEmpty(id types.PageID, buf *[common.PageSize]byte) *Page

New creates a new empty page

func (*Page) AddRLatchRecord

func (p *Page) AddRLatchRecord(info int32)

func (*Page) AddWLatchRecord

func (p *Page) AddWLatchRecord(info int32)

for debugging

func (*Page) Copy

func (p *Page) Copy(offset uint32, data []byte)

Copy copies data to the page's data

func (*Page) Data

func (p *Page) Data() *[common.PageSize]byte

Data returns the data of the page

func (*Page) DecPinCount

func (p *Page) DecPinCount()

DecPinCount decrements pin count

func (*Page) GetData

func (p *Page) GetData() *[common.PageSize]byte

func (*Page) GetLSN

func (p *Page) GetLSN() types.LSN

* @return the page LSN.

func (*Page) GetPageId

func (p *Page) GetPageId() types.PageID

GetPageId retunds the page id

func (*Page) GetRWLachObj

func (p *Page) GetRWLachObj() common.ReaderWriterLatch

func (*Page) IncPinCount

func (p *Page) IncPinCount()

IncPinCount increments pin count

func (*Page) IsDeallocated

func (p *Page) IsDeallocated() bool

func (*Page) IsDirty

func (p *Page) IsDirty() bool

IsDirty check if the page is dirty

func (*Page) PinCount

func (p *Page) PinCount() int32

PinCount retunds the pin count

func (*Page) PrintMutexDebugInfo

func (p *Page) PrintMutexDebugInfo()

func (*Page) PrintPinCount

func (p *Page) PrintPinCount()

func (*Page) RLatch

func (p *Page) RLatch()

* Acquire the page read latch.

func (*Page) RUnlatch

func (p *Page) RUnlatch()

* Release the page read latch.

func (*Page) RemoveRLatchRecord

func (p *Page) RemoveRLatchRecord(info int32)

func (*Page) RemoveWLatchRecord

func (p *Page) RemoveWLatchRecord(info int32)

func (*Page) SetIsDeallocated

func (p *Page) SetIsDeallocated(isDeallocated bool)

func (*Page) SetIsDirty

func (p *Page) SetIsDirty(isDirty bool)

SetIsDirty sets the isDirty bit

func (*Page) SetLSN

func (p *Page) SetLSN(lsn types.LSN)

* Sets the page LSN.

func (*Page) WLatch

func (p *Page) WLatch()

* Acquire the page write latch.

func (*Page) WUnlatch

func (p *Page) WUnlatch()

* Release the page write latch.

type PageIF

type PageIF interface {
	DecPinCount()
	IncPinCount()
}

currently used for SkipList only

type RID

type RID struct {
	PageId  types.PageID
	SlotNum uint32
}

RID is the record identifier for the given page identifier and slot number

func (*RID) GetAsStr

func (r *RID) GetAsStr() string

func (*RID) GetPageId

func (r *RID) GetPageId() types.PageID

GetPageId gets the page id

func (*RID) GetSlotNum

func (r *RID) GetSlotNum() uint32

GetSlotNum gets the slot number

func (*RID) Set

func (r *RID) Set(pageId types.PageID, slot uint32)

Set sets the recod identifier

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL