kvrwset

package
v0.0.0-...-7fbf1d1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_kv_rwset_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type HashedRWSet

type HashedRWSet struct {

	// HashedReads 表示使用哈希函数对读取的键进行哈希处理后的结果。数组中的每个元素是一个 KVReadHash 结构体,包含哈希后的键
	// 和对应的版本号。
	HashedReads []*KVReadHash `protobuf:"bytes,1,rep,name=hashed_reads,json=hashedReads,proto3" json:"hashed_reads,omitempty"`
	// HashedWrites 表示使用哈希函数对写入的键进行哈希处理后结果。数组中的每个元素是一个 KVWriteHash 结构体,包含哈希后的键、
	// 值和对应的版本号。
	HashedWrites []*KVWriteHash `protobuf:"bytes,2,rep,name=hashed_writes,json=hashedWrites,proto3" json:"hashed_writes,omitempty"`
	// MetadataWrites 表示使用哈希函数对元数据写入的键进行哈希处理后的结果。数组中的每个元素是一个 KVMetadataWriteHash结构体,
	// 包含哈希后的键、元数据和对应的版本号。
	MetadataWrites []*KVMetadataWriteHash `protobuf:"bytes,3,rep,name=metadata_writes,json=metadataWrites,proto3" json:"metadata_writes,omitempty"`
	// contains filtered or unexported fields
}

HashedRWSet 结构体用于封装基于哈希的读写集。它主要在提交交易时用于有效性和完整性校验。

func (*HashedRWSet) Descriptor deprecated

func (*HashedRWSet) Descriptor() ([]byte, []int)

Deprecated: Use HashedRWSet.ProtoReflect.Descriptor instead.

func (*HashedRWSet) GetHashedReads

func (x *HashedRWSet) GetHashedReads() []*KVReadHash

func (*HashedRWSet) GetHashedWrites

func (x *HashedRWSet) GetHashedWrites() []*KVWriteHash

func (*HashedRWSet) GetMetadataWrites

func (x *HashedRWSet) GetMetadataWrites() []*KVMetadataWriteHash

func (*HashedRWSet) ProtoMessage

func (*HashedRWSet) ProtoMessage()

func (*HashedRWSet) ProtoReflect

func (x *HashedRWSet) ProtoReflect() protoreflect.Message

func (*HashedRWSet) Reset

func (x *HashedRWSet) Reset()

func (*HashedRWSet) String

func (x *HashedRWSet) String() string

type KVMetadataEntry

type KVMetadataEntry struct {

	// Name 表示元数据条目的名称。
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Value 表示元数据条目的值。
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

KVMetadataEntry 结构体用于表示与键或者键的哈希相关联的元数据中的具体条目。

func (*KVMetadataEntry) Descriptor deprecated

func (*KVMetadataEntry) Descriptor() ([]byte, []int)

Deprecated: Use KVMetadataEntry.ProtoReflect.Descriptor instead.

func (*KVMetadataEntry) GetName

func (x *KVMetadataEntry) GetName() string

func (*KVMetadataEntry) GetValue

func (x *KVMetadataEntry) GetValue() []byte

func (*KVMetadataEntry) ProtoMessage

func (*KVMetadataEntry) ProtoMessage()

func (*KVMetadataEntry) ProtoReflect

func (x *KVMetadataEntry) ProtoReflect() protoreflect.Message

func (*KVMetadataEntry) Reset

func (x *KVMetadataEntry) Reset()

func (*KVMetadataEntry) String

func (x *KVMetadataEntry) String() string

type KVMetadataWrite

type KVMetadataWrite struct {

	// Key 表示若干元数据条目所关联的键。
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// Entries 表示所关联的元数据条目,是一个数组,其内的每个元素是一个 KVMetadataEntry 结构体,包含元数据的名称和值。
	Entries []*KVMetadataEntry `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries,omitempty"`
	// contains filtered or unexported fields
}

KVMetadataWrite 结构体用于表示与一个键关联的所有元数据条目。

func (*KVMetadataWrite) Descriptor deprecated

func (*KVMetadataWrite) Descriptor() ([]byte, []int)

Deprecated: Use KVMetadataWrite.ProtoReflect.Descriptor instead.

func (*KVMetadataWrite) GetEntries

func (x *KVMetadataWrite) GetEntries() []*KVMetadataEntry

func (*KVMetadataWrite) GetKey

func (x *KVMetadataWrite) GetKey() string

func (*KVMetadataWrite) ProtoMessage

func (*KVMetadataWrite) ProtoMessage()

func (*KVMetadataWrite) ProtoReflect

func (x *KVMetadataWrite) ProtoReflect() protoreflect.Message

func (*KVMetadataWrite) Reset

func (x *KVMetadataWrite) Reset()

func (*KVMetadataWrite) String

func (x *KVMetadataWrite) String() string

type KVMetadataWriteHash

type KVMetadataWriteHash struct {

	// KeyHash 表示要写元数据的键的希值。
	KeyHash []byte `protobuf:"bytes,1,opt,name=key_hash,json=keyHash,proto3" json:"key_hash,omitempty"`
	// Entries 表示要写入元数据条目。是一个数组,其内的每个元素是一个 KVMetadataEntry 结构体,包含元数据的名称和值。
	Entries []*KVMetadataEntry `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries,omitempty"`
	// contains filtered or unexported fields
}

KVMetadataWriteHash 结构体用于表示与一个键的哈希值关联的所有元数据条目的写操作。

func (*KVMetadataWriteHash) Descriptor deprecated

func (*KVMetadataWriteHash) Descriptor() ([]byte, []int)

Deprecated: Use KVMetadataWriteHash.ProtoReflect.Descriptor instead.

func (*KVMetadataWriteHash) GetEntries

func (x *KVMetadataWriteHash) GetEntries() []*KVMetadataEntry

func (*KVMetadataWriteHash) GetKeyHash

func (x *KVMetadataWriteHash) GetKeyHash() []byte

func (*KVMetadataWriteHash) ProtoMessage

func (*KVMetadataWriteHash) ProtoMessage()

func (*KVMetadataWriteHash) ProtoReflect

func (x *KVMetadataWriteHash) ProtoReflect() protoreflect.Message

func (*KVMetadataWriteHash) Reset

func (x *KVMetadataWriteHash) Reset()

func (*KVMetadataWriteHash) String

func (x *KVMetadataWriteHash) String() string

type KVRWSet

type KVRWSet struct {

	// Reads 表示链码对键值对的读取操作。数组内的每个元素是一个 KVRead 结构体,包含要读取的键和对应的版本号。
	Reads []*KVRead `protobuf:"bytes,1,rep,name=reads,proto3" json:"reads,omitempty"`
	// RangeQueriesInfo 表示链码对键范围查询的信息。数组内的每个元素是一个 RangeQueryInfo 结构体,包含查询的起始和结束键。
	RangeQueriesInfo []*RangeQueryInfo `protobuf:"bytes,2,rep,name=range_queries_info,json=rangeQueriesInfo,proto3" json:"range_queries_info,omitempty"`
	// Writes 表示链码对键值对的写入操作。数组内的每个元素是一个 KVWrite 结构体,包含要写入的键、值和对应的版本号。
	Writes []*KVWrite `protobuf:"bytes,3,rep,name=writes,proto3" json:"writes,omitempty"`
	// MetadataWrites 表示链码对键值元数据的写入操作。数组内的每个元素是一个 KVMetadataWrite 结构体,包含要写入的键、元数据和对应的版本号。
	MetadataWrites []*KVMetadataWrite `protobuf:"bytes,4,rep,name=metadata_writes,json=metadataWrites,proto3" json:"metadata_writes,omitempty"`
	// contains filtered or unexported fields
}

KVRWSet 结构体用于封装基于 KV 或文档数据模型的链码的读写集。它被用于表示公共数据私有数据的读写集。

func (*KVRWSet) Descriptor deprecated

func (*KVRWSet) Descriptor() ([]byte, []int)

Deprecated: Use KVRWSet.ProtoReflect.Descriptor instead.

func (*KVRWSet) GetMetadataWrites

func (x *KVRWSet) GetMetadataWrites() []*KVMetadataWrite

func (*KVRWSet) GetRangeQueriesInfo

func (x *KVRWSet) GetRangeQueriesInfo() []*RangeQueryInfo

func (*KVRWSet) GetReads

func (x *KVRWSet) GetReads() []*KVRead

func (*KVRWSet) GetWrites

func (x *KVRWSet) GetWrites() []*KVWrite

func (*KVRWSet) ProtoMessage

func (*KVRWSet) ProtoMessage()

func (*KVRWSet) ProtoReflect

func (x *KVRWSet) ProtoReflect() protoreflect.Message

func (*KVRWSet) Reset

func (x *KVRWSet) Reset()

func (*KVRWSet) String

func (x *KVRWSet) String() string

type KVRead

type KVRead struct {

	// Key 表示要读取的键。
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// Version 表示读取键的版本号。如果版本号为 nil,则表示事务读取的键不存在。
	Version *Version `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

KVRead 结构体的用途是记录在事务模拟过程中读取的键和对应的版本号。它被用于构建 KVRWSet 结构体的 Reads 字段,以记录链码对数据的读取操作。

func (*KVRead) Descriptor deprecated

func (*KVRead) Descriptor() ([]byte, []int)

Deprecated: Use KVRead.ProtoReflect.Descriptor instead.

func (*KVRead) GetKey

func (x *KVRead) GetKey() string

func (*KVRead) GetVersion

func (x *KVRead) GetVersion() *Version

func (*KVRead) ProtoMessage

func (*KVRead) ProtoMessage()

func (*KVRead) ProtoReflect

func (x *KVRead) ProtoReflect() protoreflect.Message

func (*KVRead) Reset

func (x *KVRead) Reset()

func (*KVRead) String

func (x *KVRead) String() string

type KVReadHash

type KVReadHash struct {

	// KeyHash 表示键的哈希值。
	KeyHash []byte `protobuf:"bytes,1,opt,name=key_hash,json=keyHash,proto3" json:"key_hash,omitempty"`
	// Version 与 KVRead 结构体相同,表示读取键的版本号。
	Version *Version `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

KVReadHash 结构体类似于 KVRead 结构体,但是它包含的是键的哈希值而不是键本身。

func (*KVReadHash) Descriptor deprecated

func (*KVReadHash) Descriptor() ([]byte, []int)

Deprecated: Use KVReadHash.ProtoReflect.Descriptor instead.

func (*KVReadHash) GetKeyHash

func (x *KVReadHash) GetKeyHash() []byte

func (*KVReadHash) GetVersion

func (x *KVReadHash) GetVersion() *Version

func (*KVReadHash) ProtoMessage

func (*KVReadHash) ProtoMessage()

func (*KVReadHash) ProtoReflect

func (x *KVReadHash) ProtoReflect() protoreflect.Message

func (*KVReadHash) Reset

func (x *KVReadHash) Reset()

func (*KVReadHash) String

func (x *KVReadHash) String() string

type KVWrite

type KVWrite struct {

	// Key 表示要写入的键
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// IsDelete 表示是否是删除操作。如果为true表示要删除键;如果为false,则表示要更新键。
	IsDelete bool `protobuf:"varint,2,opt,name=is_delete,json=isDelete,proto3" json:"is_delete,omitempty"`
	// Value 表示要写入的值。
	Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

KVWrite 结构用于表示在事务模过程中进行写入(更新/删除)操作。

func (*KVWrite) Descriptor deprecated

func (*KVWrite) Descriptor() ([]byte, []int)

Deprecated: Use KVWrite.ProtoReflect.Descriptor instead.

func (*KVWrite) GetIsDelete

func (x *KVWrite) GetIsDelete() bool

func (*KVWrite) GetKey

func (x *KVWrite) GetKey() string

func (*KVWrite) GetValue

func (x *KVWrite) GetValue() []byte

func (*KVWrite) ProtoMessage

func (*KVWrite) ProtoMessage()

func (*KVWrite) ProtoReflect

func (x *KVWrite) ProtoReflect() protoreflect.Message

func (*KVWrite) Reset

func (x *KVWrite) Reset()

func (*KVWrite) String

func (x *KVWrite) String() string

type KVWriteHash

type KVWriteHash struct {

	// KeyHash 表示要写入的键的哈希值。
	KeyHash []byte `protobuf:"bytes,1,opt,name=key_hash,json=keyHash,proto3" json:"key_hash,omitempty"`
	// IsDelete 表示是否是删除操作。如果为true表示要删除键;如果为false,则表示要更新键。
	IsDelete bool `protobuf:"varint,2,opt,name=is_delete,json=isDelete,proto3" json:"is_delete,omitempty"`
	// ValueHash 表示要写入的值的哈希值。
	ValueHash []byte `protobuf:"bytes,3,opt,name=value_hash,json=valueHash,proto3" json:"value_hash,omitempty"`
	// IsPurge 表示是否是清除操作。如果为true,则表示要清除键和对应的值。
	IsPurge bool `protobuf:"varint,4,opt,name=is_purge,json=isPurge,proto3" json:"is_purge,omitempty"`
	// contains filtered or unexported fields
}

KVWriteHash 结构体类似于 KVWrite 结构体,用于表示在事务模拟过程中进行的写入(更新/删除)操作。

func (*KVWriteHash) Descriptor deprecated

func (*KVWriteHash) Descriptor() ([]byte, []int)

Deprecated: Use KVWriteHash.ProtoReflect.Descriptor instead.

func (*KVWriteHash) GetIsDelete

func (x *KVWriteHash) GetIsDelete() bool

func (*KVWriteHash) GetIsPurge

func (x *KVWriteHash) GetIsPurge() bool

func (*KVWriteHash) GetKeyHash

func (x *KVWriteHash) GetKeyHash() []byte

func (*KVWriteHash) GetValueHash

func (x *KVWriteHash) GetValueHash() []byte

func (*KVWriteHash) ProtoMessage

func (*KVWriteHash) ProtoMessage()

func (*KVWriteHash) ProtoReflect

func (x *KVWriteHash) ProtoReflect() protoreflect.Message

func (*KVWriteHash) Reset

func (x *KVWriteHash) Reset()

func (*KVWriteHash) String

func (x *KVWriteHash) String() string

type QueryReads

type QueryReads struct {

	// KvReads 表示查询读取的项,是一个数组,其内的每个元素是一个 KVRead 结构体,包含读取的键和对应的版本号。
	KvReads []*KVRead `protobuf:"bytes,1,rep,name=kv_reads,json=kvReads,proto3" json:"kv_reads,omitempty"`
	// contains filtered or unexported fields
}

QueryReads 结构体封装了作为查询执行结果而由交易读取的键值对的多个 KVRead。

func (*QueryReads) Descriptor deprecated

func (*QueryReads) Descriptor() ([]byte, []int)

Deprecated: Use QueryReads.ProtoReflect.Descriptor instead.

func (*QueryReads) GetKvReads

func (x *QueryReads) GetKvReads() []*KVRead

func (*QueryReads) ProtoMessage

func (*QueryReads) ProtoMessage()

func (*QueryReads) ProtoReflect

func (x *QueryReads) ProtoReflect() protoreflect.Message

func (*QueryReads) Reset

func (x *QueryReads) Reset()

func (*QueryReads) String

func (x *QueryReads) String() string

type QueryReadsMerkleSummary

type QueryReadsMerkleSummary struct {

	// MaxDegree 表示树中任意级别的最大子节点数。
	MaxDegree uint32 `protobuf:"varint,1,opt,name=max_degree,json=maxDegree,proto3" json:"max_degree,omitempty"`
	// MaxLevel 包含具有少于 MaxDegree 节点的最低级别(从叶级别开始)。
	MaxLevel uint32 `protobuf:"varint,2,opt,name=max_level,json=maxLevel,proto3" json:"max_level,omitempty"`
	// MaxLevelHashes 表示最高级别中的哈希值。
	MaxLevelHashes [][]byte `protobuf:"bytes,3,rep,name=max_level_hashes,json=maxLevelHashes,proto3" json:"max_level_hashes,omitempty"`
	// contains filtered or unexported fields
}

QueryReadsMerkleSummary 结构体封装了 QueryReads 的默克尔树哈希。它允许在查询结果存在的情况下,通过存储某些哈希而不是实际结果来减小 RWSet 的大小。

func (*QueryReadsMerkleSummary) Descriptor deprecated

func (*QueryReadsMerkleSummary) Descriptor() ([]byte, []int)

Deprecated: Use QueryReadsMerkleSummary.ProtoReflect.Descriptor instead.

func (*QueryReadsMerkleSummary) GetMaxDegree

func (x *QueryReadsMerkleSummary) GetMaxDegree() uint32

func (*QueryReadsMerkleSummary) GetMaxLevel

func (x *QueryReadsMerkleSummary) GetMaxLevel() uint32

func (*QueryReadsMerkleSummary) GetMaxLevelHashes

func (x *QueryReadsMerkleSummary) GetMaxLevelHashes() [][]byte

func (*QueryReadsMerkleSummary) ProtoMessage

func (*QueryReadsMerkleSummary) ProtoMessage()

func (*QueryReadsMerkleSummary) ProtoReflect

func (x *QueryReadsMerkleSummary) ProtoReflect() protoreflect.Message

func (*QueryReadsMerkleSummary) Reset

func (x *QueryReadsMerkleSummary) Reset()

func (*QueryReadsMerkleSummary) String

func (x *QueryReadsMerkleSummary) String() string

type RangeQueryInfo

type RangeQueryInfo struct {

	// StartKey 表示范围查询的起始键。
	StartKey string `protobuf:"bytes,1,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"`
	// EndKey 表示范围查询的结束键。
	EndKey string `protobuf:"bytes,2,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"`
	// ItrExhausted 表示范围查询是否已耗尽。如果为true,则表示范围查询已经遍历完所有结果,否则表示范围查询还
	// 有更多的结果等待读取。
	ItrExhausted bool `protobuf:"varint,3,opt,name=itr_exhausted,json=itrExhausted,proto3" json:"itr_exhausted,omitempty"`
	// ReadsInfo 表示范围查询的读取信息。ReadsInfo 字段是一个 oneof 类型,可以是 RawReads 字段或 ReadsMerkleHashes 字段。
	//
	// Types that are assignable to ReadsInfo:
	//
	//	*RangeQueryInfo_RawReads
	//	*RangeQueryInfo_ReadsMerkleHashes
	ReadsInfo isRangeQueryInfo_ReadsInfo `protobuf_oneof:"reads_info"`
	// contains filtered or unexported fields
}

RangeQueryInfo 结构体用于封装交易在模拟过程中执行的范围查询的详细信息。它帮助在验证过程中保护交易免受幻读 的影响,通过验证在事务模拟和验证之间是否有新的项在给定范围内被提交(除了对现有项的更新/删除进行常规检查)。

func (*RangeQueryInfo) Descriptor deprecated

func (*RangeQueryInfo) Descriptor() ([]byte, []int)

Deprecated: Use RangeQueryInfo.ProtoReflect.Descriptor instead.

func (*RangeQueryInfo) GetEndKey

func (x *RangeQueryInfo) GetEndKey() string

func (*RangeQueryInfo) GetItrExhausted

func (x *RangeQueryInfo) GetItrExhausted() bool

func (*RangeQueryInfo) GetRawReads

func (x *RangeQueryInfo) GetRawReads() *QueryReads

func (*RangeQueryInfo) GetReadsInfo

func (m *RangeQueryInfo) GetReadsInfo() isRangeQueryInfo_ReadsInfo

func (*RangeQueryInfo) GetReadsMerkleHashes

func (x *RangeQueryInfo) GetReadsMerkleHashes() *QueryReadsMerkleSummary

func (*RangeQueryInfo) GetStartKey

func (x *RangeQueryInfo) GetStartKey() string

func (*RangeQueryInfo) ProtoMessage

func (*RangeQueryInfo) ProtoMessage()

func (*RangeQueryInfo) ProtoReflect

func (x *RangeQueryInfo) ProtoReflect() protoreflect.Message

func (*RangeQueryInfo) Reset

func (x *RangeQueryInfo) Reset()

func (*RangeQueryInfo) String

func (x *RangeQueryInfo) String() string

type RangeQueryInfo_RawReads

type RangeQueryInfo_RawReads struct {
	// RawReads 表示范围查询的KVReads,即查询执行的结果中读取的项。其内的每个元素是一个 KVRead 结构体,记录了查询读取的键和对应的版本号。
	RawReads *QueryReads `protobuf:"bytes,4,opt,name=raw_reads,json=rawReads,proto3,oneof"`
}

type RangeQueryInfo_ReadsMerkleHashes

type RangeQueryInfo_ReadsMerkleHashes struct {
	// ReadsMerkleHashes 如果范围查询的 KVReads 超过了预先配置的数量,ReadsMerkleHashes 字段将包含一个默克尔树哈希,用摘要表示范围查询的读取结果。
	ReadsMerkleHashes *QueryReadsMerkleSummary `protobuf:"bytes,5,opt,name=reads_merkle_hashes,json=readsMerkleHashes,proto3,oneof"`
}

type Version

type Version struct {

	// BlockNum 区块号。
	BlockNum uint64 `protobuf:"varint,1,opt,name=block_num,json=blockNum,proto3" json:"block_num,omitempty"`
	// TxNum 提交该键的交易在区块中的编号。
	TxNum uint64 `protobuf:"varint,2,opt,name=tx_num,json=txNum,proto3" json:"tx_num,omitempty"`
	// contains filtered or unexported fields
}

Version 结构体用于封装一个键的版本信息。一个已提交键的版本由提交该键的交易的高度来表示。版本的高度被表示 为一个元组 <blockNum, txNum>,其中 txNum 是在区块内的交易位置(从 0 开始)。

func (*Version) Descriptor deprecated

func (*Version) Descriptor() ([]byte, []int)

Deprecated: Use Version.ProtoReflect.Descriptor instead.

func (*Version) GetBlockNum

func (x *Version) GetBlockNum() uint64

func (*Version) GetTxNum

func (x *Version) GetTxNum() uint64

func (*Version) ProtoMessage

func (*Version) ProtoMessage()

func (*Version) ProtoReflect

func (x *Version) ProtoReflect() protoreflect.Message

func (*Version) Reset

func (x *Version) Reset()

func (*Version) String

func (x *Version) String() string

Jump to

Keyboard shortcuts

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