mvmap

package
v7.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterator

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

Iterator is used to iterate the MVMap.

func (*Iterator) Next

func (i *Iterator) Next() (key, value []byte)

Next returns the next key/value pair of the MVMap. It returns (nil, nil) when there is no more entries to iterate.

type MVMap

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

MVMap stores multiple value for a given key with minimum GC overhead. A given key can store multiple values. It is not thread-safe, should only be used in one goroutine.

func NewMVMap

func NewMVMap() *MVMap

NewMVMap creates a new multi-value map.

func (*MVMap) Get

func (m *MVMap) Get(key []byte, values [][]byte) [][]byte

Get gets the values of the "key" and appends them to "values".

func (*MVMap) Len

func (m *MVMap) Len() int

Len returns the number of values in th mv map, the number of keys may be less than Len if the same key is put more than once.

func (*MVMap) NewIterator

func (m *MVMap) NewIterator() *Iterator

NewIterator creates a iterator for the MVMap.

func (*MVMap) Put

func (m *MVMap) Put(key, value []byte)

Put puts the key/value pairs to the MVMap, if the key already exists, old value will not be overwritten, values are stored in a list.

Jump to

Keyboard shortcuts

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