needle_map

package
v0.0.0-...-d8c34b0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: Apache-2.0 Imports: 5 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 uint32) []byte

Types

type BtreeMap

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

This map assumes mostly inserting increasing keys

func NewBtreeMap

func NewBtreeMap() *BtreeMap

func (*BtreeMap) AscendingVisit

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

Visit visits all entries or stop if any error when visiting

func (*BtreeMap) Delete

func (cm *BtreeMap) Delete(key NeedleId) (oldSize uint32)

func (*BtreeMap) Get

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

func (*BtreeMap) Set

func (cm *BtreeMap) Set(key NeedleId, offset Offset, size uint32) (oldOffset Offset, oldSize uint32)

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) uint32

func (*CompactMap) Get

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

func (*CompactMap) Set

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

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) uint32

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 uint32) (oldOffset Offset, oldSize uint32)

return old entry size

type NeedleValue

type NeedleValue struct {
	Key    NeedleId
	Offset Offset `comment:"Volume offset"` //since aligned to 8 bytes, range is 4G*8=32G
	Size   uint32 `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 uint32) (oldOffset Offset, oldSize uint32)
	Delete(key NeedleId) uint32
	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        uint32      `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