needle

package
v0.0.0-...-9931aa1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

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

func (*BtreeMap) Get

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

func (*BtreeMap) Set

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

func (*BtreeMap) Visit

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

Visit visits all entries or stop if any error when visiting

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

func (cm *CompactMap) Delete(key Key) uint32

func (*CompactMap) Get

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

func (*CompactMap) Set

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

func (*CompactMap) Visit

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

Visit visits all entries or stop if any error when visiting

type CompactSection

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

func NewCompactSection

func NewCompactSection(start Key) *CompactSection

func (*CompactSection) Delete

func (cs *CompactSection) Delete(key Key) uint32

return old entry size

func (*CompactSection) Get

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

func (*CompactSection) Set

func (cs *CompactSection) Set(key Key, offset, size uint32) (oldOffset, oldSize uint32)

return old entry size

type Key

type Key uint64

func (Key) String

func (k Key) String() string

type NeedleValue

type NeedleValue struct {
	Key    Key
	Offset uint32 `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

type NeedleValueMap

type NeedleValueMap interface {
	Set(key Key, offset, size uint32) (oldOffset, oldSize uint32)
	Delete(key Key) uint32
	Get(key Key) (*NeedleValue, bool)
	Visit(visit func(NeedleValue) error) error
}

Jump to

Keyboard shortcuts

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