Documentation ¶
Overview ¶
Package slotting contains managers which deal with slots on pages.
FreeLogicalSlotManager ¶
FreeLogicalSlotManager is a list manager for free logical slots. This manager object is used by the LogicalSlotManager.
FreePhysicalSlotManager ¶
FreePhysicalSlotManager is a list manager for free physical slots. This manager object is used by the PhysicalSlotManager.
LogicalSlotManager ¶
LogicalSlotManager is a list manager for logical slots. Logical slots are stored on translation pages which store just pointers to physical slots.
PhysicalSlotManager ¶
PhysicalSlotManager is a list manager for physical slots.
Index ¶
- Constants
- type FreeLogicalSlotManager
- type FreePhysicalSlotManager
- type LogicalSlotManager
- func (lsm *LogicalSlotManager) ElementsPerPage() uint16
- func (lsm *LogicalSlotManager) Fetch(logicalSlot uint64) (uint64, error)
- func (lsm *LogicalSlotManager) Flush() error
- func (lsm *LogicalSlotManager) ForceInsert(logicalSlot uint64, location uint64) error
- func (lsm *LogicalSlotManager) Free(logicalSlot uint64) error
- func (lsm *LogicalSlotManager) Insert(location uint64) (uint64, error)
- func (lsm *LogicalSlotManager) Update(logicalSlot uint64, location uint64) error
- type PhysicalSlotManager
- func (psm *PhysicalSlotManager) Fetch(location uint64, writer io.Writer) error
- func (psm *PhysicalSlotManager) Flush() error
- func (psm *PhysicalSlotManager) Free(location uint64) error
- func (psm *PhysicalSlotManager) Insert(data []byte, start uint32, length uint32) (uint64, error)
- func (psm *PhysicalSlotManager) Update(location uint64, data []byte, start uint32, length uint32) (uint64, error)
Constants ¶
const AllocationRoundUpThreshold = 16
AllocationRoundUpThreshold is used to decide if a slot size should be rounded up. If an allocation would leave less than AllocationRoundUpThreshold + 1 left on the page then the allocation size is rounded up to fit the page
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FreeLogicalSlotManager ¶
type FreeLogicalSlotManager struct {
// contains filtered or unexported fields
}
FreeLogicalSlotManager data structure
func NewFreeLogicalSlotManager ¶
func NewFreeLogicalSlotManager(psf *paging.PagedStorageFile) *FreeLogicalSlotManager
NewFreeLogicalSlotManager creates a new object to manage free logical slots.
func (*FreeLogicalSlotManager) Add ¶
func (flsm *FreeLogicalSlotManager) Add(loc uint64)
Add adds a slot to the free slot set.
func (*FreeLogicalSlotManager) Flush ¶
func (flsm *FreeLogicalSlotManager) Flush() error
Flush writes all added slotinfos to FreeLogicalSlotPages.
func (*FreeLogicalSlotManager) Get ¶
func (flsm *FreeLogicalSlotManager) Get() (uint64, error)
Get gets a free slot.
func (*FreeLogicalSlotManager) String ¶
func (flsm *FreeLogicalSlotManager) String() string
Returns a string representation of this FreeLogicalSlotManager.
type FreePhysicalSlotManager ¶
type FreePhysicalSlotManager struct {
// contains filtered or unexported fields
}
FreePhysicalSlotManager data structure
func NewFreePhysicalSlotManager ¶
func NewFreePhysicalSlotManager(psf *paging.PagedStorageFile, onlyAppend bool) *FreePhysicalSlotManager
NewFreePhysicalSlotManager creates a new object to manage free physical slots.
func (*FreePhysicalSlotManager) Add ¶
func (fpsm *FreePhysicalSlotManager) Add(loc uint64, size uint32)
Add adds a slotinfo to the free slot set.
func (*FreePhysicalSlotManager) Flush ¶
func (fpsm *FreePhysicalSlotManager) Flush() error
Flush writes all added slotinfos to FreePhysicalSlotPages.
func (*FreePhysicalSlotManager) Get ¶
func (fpsm *FreePhysicalSlotManager) Get(size uint32) (uint64, error)
Get searches for a free location with the given size.
func (*FreePhysicalSlotManager) String ¶
func (fpsm *FreePhysicalSlotManager) String() string
String returns a string representation of this FreePhysicalSlotManager.
type LogicalSlotManager ¶
type LogicalSlotManager struct {
// contains filtered or unexported fields
}
LogicalSlotManager data structure
func NewLogicalSlotManager ¶
func NewLogicalSlotManager(lsf *paging.PagedStorageFile, flsf *paging.PagedStorageFile) *LogicalSlotManager
NewLogicalSlotManager creates a new object to manage logical slots. This factory function requires two PagedStorageFiles the first will hold the actual logical slots, the second is used to manage free logical slots.
func (*LogicalSlotManager) ElementsPerPage ¶
func (lsm *LogicalSlotManager) ElementsPerPage() uint16
ElementsPerPage returns the available elements per page.
func (*LogicalSlotManager) Fetch ¶
func (lsm *LogicalSlotManager) Fetch(logicalSlot uint64) (uint64, error)
Fetch looks up a physical slot using a given logical slot.
func (*LogicalSlotManager) Flush ¶
func (lsm *LogicalSlotManager) Flush() error
Flush writes all pending changes.
func (*LogicalSlotManager) ForceInsert ¶
func (lsm *LogicalSlotManager) ForceInsert(logicalSlot uint64, location uint64) error
ForceInsert inserts a given physical slot info at a given logical slot.
func (*LogicalSlotManager) Free ¶
func (lsm *LogicalSlotManager) Free(logicalSlot uint64) error
Free frees a given logical slot. The given slot is given to the FreeLogicalSlotManager.
type PhysicalSlotManager ¶
type PhysicalSlotManager struct {
// contains filtered or unexported fields
}
PhysicalSlotManager data structure
func NewPhysicalSlotManager ¶
func NewPhysicalSlotManager(psf *paging.PagedStorageFile, fpsf *paging.PagedStorageFile, onlyAppend bool) *PhysicalSlotManager
NewPhysicalSlotManager creates a new object to manage physical slots. This factory function requires two PagedStorageFiles the first will hold the actual physical slots, the second is used to manage free physical slots.
func (*PhysicalSlotManager) Fetch ¶
func (psm *PhysicalSlotManager) Fetch(location uint64, writer io.Writer) error
Fetch fetches data from a specified location.
func (*PhysicalSlotManager) Flush ¶
func (psm *PhysicalSlotManager) Flush() error
Flush writes all pending changes.
func (*PhysicalSlotManager) Free ¶
func (psm *PhysicalSlotManager) Free(location uint64) error
Free frees a given physical slot. The given slot is given to the FreePhysicalSlotManager.