pageview

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package pageview contains object wrappers for different page types.

DataPage

DataPage is a page which holds actual data.

FreeLogicalSlotPage

FreeLogicalSlotPage is a page which holds information about free logical slots. The page stores the slot location in a slotinfo data structure.

FreePhysicalSlotPage

FreePhysicalSlotPage is a page which holds information about free physical slots. The page stores the slot location and its size in a slotinfo data structure (see util/slotsize.go).

SlotInfoPage

SlotInfoPage is the super-struct for all page views which manage slotinfos. Slotinfo are location (see util/location.go) pointers into the data store containing record id and offset.

TransPage

TransPage is a page which holds data to translate between physical and logical slots.

Index

Constants

View Source
const OffsetCount = view.OffsetData

OffsetCount is the number of free slots which are stored on this page

View Source
const OffsetData = OffsetCount + file.SizeShort

OffsetData is the offset for slot information

View Source
const OffsetFirst = view.OffsetData

OffsetFirst is a pointer to first element on the page

View Source
const OffsetTransData = view.OffsetData

OffsetTransData is the data offset for translation pages

View Source
const OptimalWasteMargin = 128

OptimalWasteMargin is the max amount of allowed allocation waste. When searching a slot on this page we should strife to find a slot which doesn't waste more than OptimalWasteMargin bytes

View Source
const SlotInfoSize = util.LocationSize + util.SizeInfoSize

SlotInfoSize is the size of a single free slot info

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPage

type DataPage struct {
	*SlotInfoPage
}

DataPage data structure

func NewDataPage

func NewDataPage(record *file.Record) *DataPage

NewDataPage creates a new page which holds actual data.

func NewTransPage

func NewTransPage(record *file.Record) *DataPage

NewTransPage creates a new page which holds data to translate between physical and logical slots.

func (*DataPage) DataSpace

func (dp *DataPage) DataSpace() uint16

DataSpace returns the available data space on this page.

func (*DataPage) OffsetFirst

func (dp *DataPage) OffsetFirst() uint16

OffsetFirst returns the pointer to the first element on the page.

func (*DataPage) SetOffsetFirst

func (dp *DataPage) SetOffsetFirst(first uint16)

SetOffsetFirst sets the pointer to the first element on the page.

type FreeLogicalSlotPage

type FreeLogicalSlotPage struct {
	*SlotInfoPage
	// contains filtered or unexported fields
}

FreeLogicalSlotPage data structure

func NewFreeLogicalSlotPage

func NewFreeLogicalSlotPage(record *file.Record) *FreeLogicalSlotPage

NewFreeLogicalSlotPage creates a new page which can manage free slots.

func (*FreeLogicalSlotPage) AllocateSlotInfo

func (flsp *FreeLogicalSlotPage) AllocateSlotInfo(slotinfo uint16) uint16

AllocateSlotInfo allocates a place for a slotinfo and returns the offset for it.

func (*FreeLogicalSlotPage) FirstAllocatedSlotInfo

func (flsp *FreeLogicalSlotPage) FirstAllocatedSlotInfo() int

FirstAllocatedSlotInfo returns the id for the first allocated slotinfo or -1 if nothing is allocated.

func (*FreeLogicalSlotPage) FirstFreeSlotInfo

func (flsp *FreeLogicalSlotPage) FirstFreeSlotInfo() int

FirstFreeSlotInfo returns the id for the first available slotinfo or -1 if nothing is available.

func (*FreeLogicalSlotPage) FreeSlotCount

func (flsp *FreeLogicalSlotPage) FreeSlotCount() uint16

FreeSlotCount returns the number of free slots on this page.

func (*FreeLogicalSlotPage) MaxSlots

func (flsp *FreeLogicalSlotPage) MaxSlots() uint16

MaxSlots returns the maximum number of slots which can be allocated.

func (*FreeLogicalSlotPage) ReleaseSlotInfo

func (flsp *FreeLogicalSlotPage) ReleaseSlotInfo(slotinfo uint16) uint16

ReleaseSlotInfo releases a place for a slotinfo and return its offset.

func (*FreeLogicalSlotPage) SlotInfoLocation

func (flsp *FreeLogicalSlotPage) SlotInfoLocation(slotinfo uint16) uint64

SlotInfoLocation returns contents of a stored slotinfo as a location. Lookup is via a given slotinfo id.

type FreePhysicalSlotPage

type FreePhysicalSlotPage struct {
	*SlotInfoPage
	// contains filtered or unexported fields
}

FreePhysicalSlotPage data structure

func NewFreePhysicalSlotPage

func NewFreePhysicalSlotPage(record *file.Record) *FreePhysicalSlotPage

NewFreePhysicalSlotPage creates a new page which can manage free slots.

func (*FreePhysicalSlotPage) AllocateSlotInfo

func (fpsp *FreePhysicalSlotPage) AllocateSlotInfo(slotinfo uint16) uint16

AllocateSlotInfo allocates a place for a slotinfo and returns the offset for it.

func (*FreePhysicalSlotPage) FindSlot

func (fpsp *FreePhysicalSlotPage) FindSlot(minSize uint32) int

FindSlot finds a slot which is suitable for a given amount of data but which is also not too big to avoid wasting space.

func (*FreePhysicalSlotPage) FirstFreeSlotInfo

func (fpsp *FreePhysicalSlotPage) FirstFreeSlotInfo() int

FirstFreeSlotInfo returns the id for the first available slotinfo for allocation or -1 if nothing is available.

func (*FreePhysicalSlotPage) FreeSlotCount

func (fpsp *FreePhysicalSlotPage) FreeSlotCount() uint16

FreeSlotCount returns the number of free slots on this page.

func (*FreePhysicalSlotPage) FreeSlotSize

func (fpsp *FreePhysicalSlotPage) FreeSlotSize(offset uint16) uint32

FreeSlotSize returns the size of a free slot. Lookup is via offset.

func (*FreePhysicalSlotPage) MaxSlots

func (fpsp *FreePhysicalSlotPage) MaxSlots() uint16

MaxSlots returns the maximum number of slots which can be allocated.

func (*FreePhysicalSlotPage) ReleaseSlotInfo

func (fpsp *FreePhysicalSlotPage) ReleaseSlotInfo(slotinfo uint16) uint16

ReleaseSlotInfo releases a place for a slotinfo and return its offset.

func (*FreePhysicalSlotPage) SetFreeSlotSize

func (fpsp *FreePhysicalSlotPage) SetFreeSlotSize(offset uint16, size uint32)

SetFreeSlotSize sets the size of a free slot. Lookup is via offset.

func (*FreePhysicalSlotPage) SlotInfoLocation

func (fpsp *FreePhysicalSlotPage) SlotInfoLocation(slotinfo uint16) uint64

SlotInfoLocation returns contents of a stored slotinfo as a location. Lookup is via a given slotinfo id.

type SlotInfoPage

type SlotInfoPage struct {
	*view.PageView
}

SlotInfoPage data structure

func NewSlotInfoPage

func NewSlotInfoPage(record *file.Record) *SlotInfoPage

NewSlotInfoPage creates a new SlotInfoPage object which can manage slotinfos.

func (*SlotInfoPage) SetSlotInfo

func (lm *SlotInfoPage) SetSlotInfo(slotinfoOffset uint16, recordID uint64, offset uint16)

SetSlotInfo stores a slotinfo on the pageview's record.

func (*SlotInfoPage) SlotInfoOffset

func (lm *SlotInfoPage) SlotInfoOffset(offset uint16) uint16

SlotInfoOffset gets the record offset of a stored slotinfo.

func (*SlotInfoPage) SlotInfoRecord

func (lm *SlotInfoPage) SlotInfoRecord(offset uint16) uint64

SlotInfoRecord gets record id of a stored slotinfo.

type TransPage

type TransPage struct {
	*SlotInfoPage
}

TransPage data structure

Jump to

Keyboard shortcuts

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