interfaces

package
v0.0.0-...-de6961a Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item[DataType any] interface {
	Capacity() int64
	Content() DataType
	Compare(Item[DataType]) (int, error)
	IsEmpty() bool
	Load(DataType) Item[DataType]
	String() string
}

type Page

type Page[DataType any] interface {
	Add(item Item[DataType])
	AddChild(child Page[DataType])
	Capacity() int
	Child(index int) Page[DataType]
	Children(children ...[]Page[DataType]) PageChildren[DataType]
	IsLeaf() bool
	Item(index int) Item[DataType]
	Items(items ...Item[DataType]) PageItems[DataType]
	IsFull() bool
	Offset() int64
	Parent(parent ...Page[DataType]) Page[DataType]
	Size() int
	String() string
}

type PageChildren

type PageChildren[DataType any] interface {
	All() []Page[DataType]
	ChildFor(Item[DataType]) Page[DataType]
	IsFetched() bool
	Last() Page[DataType]
	Nth(int) Page[DataType]
	Offsets() []int64
	Put(offset int64)
	Set(Page[DataType], ...Page[DataType]) PageChildren[DataType]
	Size() int
	Split(int) ([]Page[DataType], []Page[DataType])
	Unload()
}

type PageItems

type PageItems[DataType any] interface {
	First() Item[DataType]
	Last() Item[DataType]
	Item(index int) Item[DataType]
	Split() ([]Item[DataType], []Item[DataType], int)
	ToSlice() []Item[DataType]
	SlotFor(item Item[DataType]) int
}

type Persistence

type Persistence[DataType any] interface {
	LoadRoot() (Page[DataType], error)
	Load(int64, ...bool) Page[DataType]
	LoadSize() (int64, error)
	NewPage(...bool) (Page[DataType], error)
	Reset()
	Save(Page[DataType]) error
	SaveRootReference(int64) error
	SaveSize(int64) error
}

type PersistenceConfig

type PersistenceConfig[DataType any] struct {
	Path            string
	PageConstructor func(int64) Page[DataType]
	ItemConstructor func() Item[DataType]
	CacheSize       uint32
}

Jump to

Keyboard shortcuts

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