indexmeta

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxNumKVs    = 255
	MaxKeySize   = 255
	MaxValueSize = 255
)

Variables

View Source
var (
	MetadataKey_Epoch   = []byte("epoch")
	MetadataKey_RootCid = []byte("rootCid")
	MetadataKey_Network = []byte("network")
)
View Source
var MetadataKey_Kind = []byte{'k', 'i', 'n', 'd'}

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	io.ByteReader
	io.Reader
}

type KV

type KV struct {
	Key   []byte
	Value []byte
}

func NewKV

func NewKV(key, value []byte) KV

type Meta

type Meta struct {
	KeyVals []KV
}

func (*Meta) Add

func (m *Meta) Add(key, value []byte) error

Add adds a key-value pair to the metadata.

func (*Meta) AddCid

func (m *Meta) AddCid(key []byte, value cid.Cid) error

func (*Meta) AddString

func (m *Meta) AddString(key []byte, value string) error

func (*Meta) AddUint64

func (m *Meta) AddUint64(key []byte, value uint64) error

func (*Meta) Bytes

func (m *Meta) Bytes() []byte

Bytes returns the serialized metadata.

func (*Meta) Count

func (m *Meta) Count(key []byte) int

Count returns the number of values for the given key.

func (Meta) Get

func (m Meta) Get(key []byte) ([]byte, bool)

Get returns the first value for the given key.

func (Meta) GetAll

func (m Meta) GetAll(key []byte) [][]byte

GetAll returns all values for the given key.

func (Meta) GetCid

func (m Meta) GetCid(key []byte) (cid.Cid, bool)

func (Meta) GetString

func (m Meta) GetString(key []byte) (string, bool)

func (Meta) GetUint64

func (m Meta) GetUint64(key []byte) (uint64, bool)

func (Meta) HasDuplicateKeys

func (m Meta) HasDuplicateKeys() bool

HasDuplicateKeys returns true if there are duplicate keys.

func (Meta) MarshalBinary

func (m Meta) MarshalBinary() ([]byte, error)

func (Meta) ReadFirst

func (m Meta) ReadFirst(key []byte, valueDst []byte) int

ReadFirst copies the first value for the given key into the given value. It returns the number of bytes copied.

func (*Meta) Remove

func (m *Meta) Remove(key []byte)

func (*Meta) Replace

func (m *Meta) Replace(key, value []byte) error

Replace replaces the first value for the given key.

func (*Meta) UnmarshalBinary

func (m *Meta) UnmarshalBinary(b []byte) error

func (*Meta) UnmarshalWithDecoder

func (m *Meta) UnmarshalWithDecoder(decoder Decoder) error

Jump to

Keyboard shortcuts

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