index

package
v1.15.0-pre.3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key []byte

Key is a byte slice describing a key used in an index by statedb. If a key is variable-sized, then it must be either terminated with e.g. zero byte or it must be length-encoded. If it is not, then a Get() may return results that don't match the query (e.g. objects indexed with a key that has the same prefix but are longer). The reason is that Get() is implemented as a prefix seek to avoid full key comparison on iteration and also to support the non-unique indexes which key on "secondary + primary" keys.

func Bool

func Bool(b bool) Key

func Int

func Int(n int) Key

func NetIP

func NetIP(ip net.IP) Key

func NetIPAddr

func NetIPAddr(addr netip.Addr) Key

func NetIPPrefix

func NetIPPrefix(prefix netip.Prefix) Key

func String

func String(s string) Key

func Stringer

func Stringer[T fmt.Stringer](s T) Key

func Uint16

func Uint16(n uint16) Key

func Uint64

func Uint64(n uint64) Key

type KeySet

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

KeySet is a sequence of (length, byte slice) pairs. length is encoded as 16-bit big-endian unsigned int.

func NewKeySet

func NewKeySet(keys ...Key) KeySet

func StringMap

func StringMap[V any](m map[string]V) KeySet

func StringSlice

func StringSlice(ss []string) KeySet

func StringerSlice

func StringerSlice[T fmt.Stringer](ss []T) KeySet

func (*KeySet) Append

func (ks *KeySet) Append(k Key)

func (KeySet) Exists

func (ks KeySet) Exists(k Key) bool

func (KeySet) First

func (ks KeySet) First() Key

func (KeySet) Foreach

func (ks KeySet) Foreach(fn func(Key))

Jump to

Keyboard shortcuts

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