buffer

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferPoolManager

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

BufferPoolManager represents the buffer pool manager

func NewBufferPoolManager

func NewBufferPoolManager(poolSize uint32, DiskManager disk.DiskManager, log_manager *recovery.LogManager) *BufferPoolManager

NewBufferPoolManager returns a empty buffer pool manager

func (*BufferPoolManager) DeallocatePage added in v0.0.2

func (b *BufferPoolManager) DeallocatePage(pageID types.PageID) error

DeallocatePage make disk space of db file which is idenfied by pageID ATTENTION: when deallocated page is requested fetch, BPM return nil

func (*BufferPoolManager) DecPinOfPage added in v0.0.2

func (b *BufferPoolManager) DecPinOfPage(page_ page.PageIF)

Decrement pin count of passed page (this can be used only when a thread has pin of page more than 1 this get lock of BufferPoolManager but overhead is smaller than UnpinPage

func (*BufferPoolManager) FetchPage

func (b *BufferPoolManager) FetchPage(pageID types.PageID) *page.Page

FetchPage fetches the requested page from the buffer pool.

func (*BufferPoolManager) FlushAllDirtyPages added in v0.0.2

func (b *BufferPoolManager) FlushAllDirtyPages()

FlushAllDitryPages flushes all dirty pages in the buffer pool to disk.

func (*BufferPoolManager) FlushAllPages

func (b *BufferPoolManager) FlushAllPages()

FlushAllPages flushes all the pages in the buffer pool to disk.

func (*BufferPoolManager) FlushPage

func (b *BufferPoolManager) FlushPage(pageID types.PageID) bool

FlushPage Flushes the target page to disk.

func (*BufferPoolManager) GetPages

func (b *BufferPoolManager) GetPages() []*page.Page

func (*BufferPoolManager) GetPoolSize

func (b *BufferPoolManager) GetPoolSize() int

func (*BufferPoolManager) IncPinOfPage added in v0.0.2

func (b *BufferPoolManager) IncPinOfPage(page_ page.PageIF)

Decrement pincount of passed page (this can be used only when a thread has pin of page more than 1 this get lock of BufferPoolManager

func (*BufferPoolManager) NewPage

func (b *BufferPoolManager) NewPage() *page.Page

NewPage allocates a new page in the buffer pool with the disk manager help

func (*BufferPoolManager) PrintBufferUsageState added in v0.0.2

func (b *BufferPoolManager) PrintBufferUsageState(callerAdditionalInfo string)

func (*BufferPoolManager) PrintReplacerInternalState added in v0.0.2

func (b *BufferPoolManager) PrintReplacerInternalState()

func (*BufferPoolManager) UnpinPage

func (b *BufferPoolManager) UnpinPage(pageID types.PageID, isDirty bool) error

ATTENTION: when Unpin a page which has pageID arg as self ID, caller thread must have WLatch of the page UnpinPage unpins the target page from the buffer pool.

type ClockReplacer

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

*

  • ClockReplacer implements the clock replacement policy, which approximates the Least Recently Used policy.

func NewClockReplacer

func NewClockReplacer(poolSize uint32) *ClockReplacer

NewClockReplacer instantiates a new clock replacer

func (*ClockReplacer) Pin

func (c *ClockReplacer) Pin(id FrameID)

Pin pins a frame, indicating that it should not be victimized until it is unpinned

func (*ClockReplacer) PrintList added in v0.0.2

func (c *ClockReplacer) PrintList()

func (*ClockReplacer) Size

func (c *ClockReplacer) Size() uint32

Size returns the size of the clock

func (*ClockReplacer) Unpin

func (c *ClockReplacer) Unpin(id FrameID)

Unpin unpins a frame, indicating that it can now be victimized

func (*ClockReplacer) Victim

func (c *ClockReplacer) Victim() *FrameID

Victim removes the victim frame as defined by the replacement policy

type FrameID

type FrameID uint32

FrameID is the type for frame id

const DEALLOCATED_FRAME FrameID = math.MaxUint32

Jump to

Keyboard shortcuts

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