needle_map

package
v0.0.0-...-5c6c1e7 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const SectionalNeedleIdLimit = 1<<32 - 1

Variables

This section is empty.

Functions

func ToBytes

func ToBytes(key NeedleId, offset Offset, size Size) []byte

Types

type CompactMap

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

This map assumes mostly inserting increasing keys This map assumes mostly inserting increasing keys

func NewCompactMap

func NewCompactMap() *CompactMap

func (*CompactMap) AscendingVisit

func (cm *CompactMap) AscendingVisit(visit func(NeedleValue) error) error

Visit visits all entries or stop if any error when visiting

func (*CompactMap) Delete

func (cm *CompactMap) Delete(key NeedleId) Size

func (*CompactMap) Get

func (cm *CompactMap) Get(key NeedleId) (*NeedleValue, bool)

func (*CompactMap) Set

func (cm *CompactMap) Set(key NeedleId, offset Offset, size Size) (oldOffset Offset, oldSize Size)

type CompactSection

type CompactSection struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCompactSection

func NewCompactSection(start NeedleId) *CompactSection

func (*CompactSection) Delete

func (cs *CompactSection) Delete(key NeedleId) Size

return old entry size

func (*CompactSection) Get

func (cs *CompactSection) Get(key NeedleId) (*NeedleValue, bool)

func (*CompactSection) Set

func (cs *CompactSection) Set(key NeedleId, offset Offset, size Size) (oldOffset Offset, oldSize Size)

return old entry size

type MemDb

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

This map uses in memory level db

func NewMemDb

func NewMemDb() *MemDb

func (*MemDb) AscendingVisit

func (cm *MemDb) AscendingVisit(visit func(NeedleValue) error) (ret error)

Visit visits all entries or stop if any error when visiting

func (*MemDb) Close

func (cm *MemDb) Close()

func (*MemDb) Delete

func (cm *MemDb) Delete(key NeedleId) error

func (*MemDb) Get

func (cm *MemDb) Get(key NeedleId) (*NeedleValue, bool)

func (*MemDb) LoadFromIdx

func (cm *MemDb) LoadFromIdx(idxName string) (ret error)

func (*MemDb) LoadFromReaderAt

func (cm *MemDb) LoadFromReaderAt(readerAt io.ReaderAt) (ret error)

func (*MemDb) SaveToIdx

func (cm *MemDb) SaveToIdx(idxName string) (ret error)

func (*MemDb) Set

func (cm *MemDb) Set(key NeedleId, offset Offset, size Size) error

type NeedleValue

type NeedleValue struct {
	Key    NeedleId
	Offset Offset `comment:"Volume offset"` //since aligned to 8 bytes, range is 4G*8=32G
	Size   Size   `comment:"Size of the data portion"`
}

func (NeedleValue) Less

func (this NeedleValue) Less(than btree.Item) bool

func (NeedleValue) ToBytes

func (nv NeedleValue) ToBytes() []byte

type NeedleValueMap

type NeedleValueMap interface {
	Set(key NeedleId, offset Offset, size Size) (oldOffset Offset, oldSize Size)
	Delete(key NeedleId) Size
	Get(key NeedleId) (*NeedleValue, bool)
	AscendingVisit(visit func(NeedleValue) error) error
}

type Overflow

type Overflow []SectionalNeedleValue

type OverflowExtra

type OverflowExtra []SectionalNeedleValueExtra

type SectionalNeedleId

type SectionalNeedleId uint32

type SectionalNeedleValue

type SectionalNeedleValue struct {
	Key         SectionalNeedleId
	OffsetLower OffsetLower `comment:"Volume offset"` //since aligned to 8 bytes, range is 4G*8=32G
	Size        Size        `comment:"Size of the data portion"`
}

type SectionalNeedleValueExtra

type SectionalNeedleValueExtra struct {
	OffsetHigher OffsetHigher
}

Jump to

Keyboard shortcuts

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