allocator

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_OFFSET = (1 << 24) - 1

Len is 24bit

Variables

This section is empty.

Functions

This section is empty.

Types

type BtreeDataPortionAlloc

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

TODO: Use ceph bitmap algorithm

func BuildBtreeDataPortionAlloc

func BuildBtreeDataPortionAlloc(capacitySector uint32) *BtreeDataPortionAlloc

func NewBtreeAlloc

func NewBtreeAlloc() *BtreeDataPortionAlloc

func (*BtreeDataPortionAlloc) Allocate

func (alloc *BtreeDataPortionAlloc) Allocate(size uint16) (free portion.DataPortion, err error)

func (*BtreeDataPortionAlloc) Display

func (alloc *BtreeDataPortionAlloc) Display()

func (*BtreeDataPortionAlloc) FreeCount

func (alloc *BtreeDataPortionAlloc) FreeCount() uint64

func (*BtreeDataPortionAlloc) GetAllocationBitStatus

func (alloc *BtreeDataPortionAlloc) GetAllocationBitStatus(n uint64, totalBlocks uint64) []float64

func (*BtreeDataPortionAlloc) MaxSegmentSize added in v0.2.0

func (alloc *BtreeDataPortionAlloc) MaxSegmentSize() uint64

func (*BtreeDataPortionAlloc) MemoryUsed

func (alloc *BtreeDataPortionAlloc) MemoryUsed() uint64

func (*BtreeDataPortionAlloc) Release

func (alloc *BtreeDataPortionAlloc) Release(p portion.DataPortion)

func (*BtreeDataPortionAlloc) RestoreFromIndex

func (alloc *BtreeDataPortionAlloc) RestoreFromIndex(blockSize block.BlockSize,
	capacityInByte uint64, vec []portion.DataPortion)

type DataPortionAlloc

type DataPortionAlloc interface {
	Display()
	Allocate(size uint16) (free portion.DataPortion, err error)
	Release(p portion.DataPortion)
	RestoreFromIndex(blockSize block.BlockSize, capacityInByte uint64, vec []portion.DataPortion)
	MemoryUsed() uint64
	FreeCount() uint64
	GetAllocationBitStatus(n uint64, totalBlocks uint64) []float64
	MaxSegmentSize() uint64
}

type JudyPortion

type JudyPortion uint64

func (JudyPortion) CheckedExtend

func (judy JudyPortion) CheckedExtend(size uint32) bool

func (JudyPortion) End

func (judy JudyPortion) End() address.Address

func (JudyPortion) Len

func (judy JudyPortion) Len() uint32

func (JudyPortion) SlicePart

func (p JudyPortion) SlicePart(size uint16) (JudyPortion, portion.DataPortion)

func (JudyPortion) Start

func (judy JudyPortion) Start() address.Address

func (JudyPortion) ToSizeBasedUint64

func (judy JudyPortion) ToSizeBasedUint64() uint64

type JudyPortionAlloc

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

the Tree here means a set

func BuildJudyAlloc

func BuildJudyAlloc(capacitySector uint32) *JudyPortionAlloc

capacitySector will always less than (1<<24),

func NewJudyAlloc

func NewJudyAlloc() *JudyPortionAlloc

func (*JudyPortionAlloc) Allocate

func (alloc *JudyPortionAlloc) Allocate(size uint16) (free portion.DataPortion, err error)

func (*JudyPortionAlloc) Display

func (alloc *JudyPortionAlloc) Display()

func (*JudyPortionAlloc) FreeCount

func (alloc *JudyPortionAlloc) FreeCount() uint64

func (*JudyPortionAlloc) GetAllocationBitStatus

func (alloc *JudyPortionAlloc) GetAllocationBitStatus(n uint64, totalBlocks uint64) []float64

n: n sector combines one float number totalBlocks: total number of blocks

func (*JudyPortionAlloc) MaxSegmentSize added in v0.2.0

func (alloc *JudyPortionAlloc) MaxSegmentSize() uint64

func (*JudyPortionAlloc) MemoryUsed

func (alloc *JudyPortionAlloc) MemoryUsed() uint64

func (*JudyPortionAlloc) Release

func (alloc *JudyPortionAlloc) Release(p portion.DataPortion)

func (*JudyPortionAlloc) RestoreFromIndex

func (alloc *JudyPortionAlloc) RestoreFromIndex(blockSize block.BlockSize,
	capacityInByte uint64, vec []portion.DataPortion)

almost the same with RestoreFromIndex of BtreeDataPortionAlloc

func (*JudyPortionAlloc) RestoreFromIndexWithJudy

func (alloc *JudyPortionAlloc) RestoreFromIndexWithJudy(blockSize block.BlockSize,
	capacityInByte uint64, judyArray *judy.Judy1)

Jump to

Keyboard shortcuts

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