allocator

package module
v0.0.0-...-359b95b Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const PointerMetaSize = 5
View Source
const PointerSize = 8 + PointerMetaSize

Variables

View Source
var ErrInvalidPointer = errors.New("invalid Pointer")
View Source
var ErrMarshal = errors.New("marshal error")
View Source
var ErrUnmarshal = errors.New("unmarshal error")

Functions

This section is empty.

Types

type Allocator

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

func Open

func Open(filename string, opts *Options) (*Allocator, error)

func (*Allocator) Alloc

func (a *Allocator) Alloc(size uint32) Pointable

func (*Allocator) Close

func (a *Allocator) Close() error

func (*Allocator) FirstPointer

func (a *Allocator) FirstPointer(size uint32) Pointable

func (*Allocator) Free

func (a *Allocator) Free(p Pointable)
func (a *Allocator) Link(ptr Pointable)

func (*Allocator) Nil

func (a *Allocator) Nil() Pointable

func (*Allocator) Pointer

func (a *Allocator) Pointer(addr uint64, size uint32) Pointable

func (*Allocator) PreAlloc

func (a *Allocator) PreAlloc(size uint32)

func (*Allocator) Print

func (a *Allocator) Print() error

func (*Allocator) Remove

func (a *Allocator) Remove()

func (*Allocator) Scan

func (a *Allocator) Scan(startPtr Pointable, scanFn func(Pointable) (bool, error)) (err error)

func (*Allocator) Size

func (a *Allocator) Size() uint64

type Options

type Options struct {
	TargetPageSize uint16
	TreePageSize   uint16
	PagerOptions   PagerOptions
}

type PagerOptions

type PagerOptions struct {
	FileName string
	PageSize int
}

type Pointable

type Pointable interface {
	Get(into encoding.BinaryUnmarshaler) error
	Set(from encoding.BinaryMarshaler) error
	Addr() uint64
	Size() uint32
	IsFree() bool
	IsNil() bool
	Copy() Pointable
	Equal(ptr Pointable) bool
	// contains filtered or unexported methods
}

type Pointer

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

func (*Pointer) Addr

func (p *Pointer) Addr() uint64

func (*Pointer) Copy

func (p *Pointer) Copy() Pointable

func (*Pointer) Equal

func (p *Pointer) Equal(ptr Pointable) bool

func (*Pointer) Format

func (p *Pointer) Format(f fmt.State, c rune)

func (*Pointer) Get

func (p *Pointer) Get(into encoding.BinaryUnmarshaler) error

func (*Pointer) IsFree

func (p *Pointer) IsFree() bool

func (*Pointer) IsNil

func (p *Pointer) IsNil() bool

func (*Pointer) MarshalBinary

func (p *Pointer) MarshalBinary() ([]byte, error)

func (*Pointer) Set

func (p *Pointer) Set(from encoding.BinaryMarshaler) error

func (*Pointer) Size

func (p *Pointer) Size() uint32

func (*Pointer) UnmarshalBinary

func (p *Pointer) UnmarshalBinary(d []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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