verification

package
v1.1.0-beta.0...-de36787 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DataKVGroupID = -1

DataKVGroupID represents the ID for data KV group, as index id starts from 1, so we use -1 to represent data kv group.

Variables

This section is empty.

Functions

This section is empty.

Types

type KVChecksum

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

KVChecksum is the checksum of a collection of key-value pairs. The zero value of KVChecksum is a checksum for empty content and zero keyspace.

func MakeKVChecksum

func MakeKVChecksum(bytes uint64, kvs uint64, checksum uint64) KVChecksum

MakeKVChecksum creates a new KVChecksum with the given checksum.

func NewKVChecksum

func NewKVChecksum() *KVChecksum

NewKVChecksum creates a pointer to zero KVChecksum.

func NewKVChecksumWithKeyspace

func NewKVChecksumWithKeyspace(keyspace []byte) *KVChecksum

NewKVChecksumWithKeyspace creates a new KVChecksum with the given checksum and keyspace.

func (*KVChecksum) Add

func (c *KVChecksum) Add(other *KVChecksum)

Add adds the checksum of another KVChecksum.

func (*KVChecksum) MarshalJSON

func (c *KVChecksum) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*KVChecksum) MarshalLogObject

func (c *KVChecksum) MarshalLogObject(encoder zapcore.ObjectEncoder) error

MarshalLogObject implements the zapcore.ObjectMarshaler interface.

func (*KVChecksum) Sum

func (c *KVChecksum) Sum() uint64

Sum returns the checksum.

func (*KVChecksum) SumKVS

func (c *KVChecksum) SumKVS() uint64

SumKVS returns the total number of key-value pairs.

func (*KVChecksum) SumSize

func (c *KVChecksum) SumSize() uint64

SumSize returns the total size of the key-value pairs.

func (*KVChecksum) Update

func (c *KVChecksum) Update(kvs []common.KvPair)

Update updates the checksum with a batch of key-value pairs.

func (*KVChecksum) UpdateOne

func (c *KVChecksum) UpdateOne(kv common.KvPair)

UpdateOne updates the checksum with a single key-value pair.

type KVGroupChecksum

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

KVGroupChecksum is KVChecksum(s) each for a data KV group or index KV groups.

func NewKVGroupChecksumForAdd

func NewKVGroupChecksumForAdd() *KVGroupChecksum

NewKVGroupChecksumForAdd creates a new KVGroupChecksum, and it can't be used with UpdateOneDataKV or UpdateOneIndexKV.

func NewKVGroupChecksumWithKeyspace

func NewKVGroupChecksumWithKeyspace(keyspace []byte) *KVGroupChecksum

NewKVGroupChecksumWithKeyspace creates a new KVGroupChecksum with the given keyspace.

func (*KVGroupChecksum) Add

func (c *KVGroupChecksum) Add(other *KVGroupChecksum)

Add adds the checksum of another KVGroupChecksum.

func (*KVGroupChecksum) AddRawGroup

func (c *KVGroupChecksum) AddRawGroup(id int64, bytes, kvs, checksum uint64)

AddRawGroup adds the raw information of a KV group.

func (*KVGroupChecksum) DataAndIndexSumKVS

func (c *KVGroupChecksum) DataAndIndexSumKVS() (dataKVS, indexKVS uint64)

DataAndIndexSumKVS returns the total number of data KV pairs and index KV pairs.

func (*KVGroupChecksum) DataAndIndexSumSize

func (c *KVGroupChecksum) DataAndIndexSumSize() (dataSize, indexSize uint64)

DataAndIndexSumSize returns the total size of data KV pairs and index KV pairs.

func (*KVGroupChecksum) GetInnerChecksums

func (c *KVGroupChecksum) GetInnerChecksums() map[int64]*KVChecksum

GetInnerChecksums returns a cloned map of index ID to its KVChecksum.

func (*KVGroupChecksum) MarshalLogObject

func (c *KVGroupChecksum) MarshalLogObject(encoder zapcore.ObjectEncoder) error

MarshalLogObject implements the zapcore.ObjectMarshaler interface.

func (*KVGroupChecksum) MergedChecksum

func (c *KVGroupChecksum) MergedChecksum() KVChecksum

MergedChecksum merges all groups of this checksum into a single KVChecksum.

func (*KVGroupChecksum) UpdateOneDataKV

func (c *KVGroupChecksum) UpdateOneDataKV(kv common.KvPair)

UpdateOneDataKV updates the checksum with a single data(record) key-value pair. It will not check the key-value pair's key is a real data key again.

func (*KVGroupChecksum) UpdateOneIndexKV

func (c *KVGroupChecksum) UpdateOneIndexKV(indexID int64, kv common.KvPair)

UpdateOneIndexKV updates the checksum with a single index key-value pair. It will not check the key-value pair's key is a real index key of that index ID again.

Jump to

Keyboard shortcuts

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