Back to godoc.org
github.com/pingcap/tidb / util / mvmap

package mvmap

v2.0.11+incompatible
Latest Go to latest
Published: Jan 3, 2019 | License: Apache-2.0 | Module: github.com/pingcap/tidb

Index

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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier