buffer

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 8 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) DeletePage

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

DeletePage deletes a page from the buffer pool.

func (*BufferPoolManager) FetchPage

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

FetchPage fetches the requested page from the buffer pool.

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) NewPage

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

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

func (*BufferPoolManager) UnpinPage

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

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) 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

Jump to

Keyboard shortcuts

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