Documentation
¶
Overview ¶
Package serialization package
Index ¶
- func DeserializeBlock(serializedBlock []byte) (*storePb.BlockWithRWSet, error)
- func DeserializeMeta(serializedBlock []byte) (*storePb.SerializedBlock, error)
- type BlockIndex
- type BlockIndexMeta
- type BlockNormalized
- type BlockNormalizer
- type BlockWithSerializedInfo
- func (b *BlockWithSerializedInfo) ReSet()
- func (b *BlockWithSerializedInfo) SerializeEventTopicTable(buf *proto.Buffer) error
- func (b *BlockWithSerializedInfo) SerializeMeta(buf *proto.Buffer) error
- func (b *BlockWithSerializedInfo) SerializeTxRWSets(buf *proto.Buffer) error
- func (b *BlockWithSerializedInfo) SerializeTxs(buf *proto.Buffer) error
- type NormalBlockNormalizer
- type SerializationNormalized
- type Serializer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeserializeBlock ¶
func DeserializeBlock(serializedBlock []byte) (*storePb.BlockWithRWSet, error)
DeserializeBlock returns a deserialized block for given serialized bytes @Description: @param serializedBlock @return *storePb.BlockWithRWSet @return error Deprecated: use NormalBlockNormalizer
func DeserializeMeta ¶ added in v2.2.0
func DeserializeMeta(serializedBlock []byte) (*storePb.SerializedBlock, error)
DeserializeMeta 反序列化 meta 数据 @Description: @param serializedBlock @return *storePb.SerializedBlock @return error
Types ¶
type BlockIndex ¶ added in v2.3.4
type BlockIndex struct { //整个Block+RWSet序列化后存储的位置 Index *storePb.StoreInfo //Block基本信息(storePb.SerializedBlock)序列化后存储的位置 MetaIndex *storePb.StoreInfo //交易列表序列化后的存储位置 TxsIndex []*storePb.StoreInfo //读写集序列化后存储的位置 RWSetsIndex []*storePb.StoreInfo }
BlockIndex file block's block index detail @Description:
type BlockIndexMeta ¶ added in v2.3.4
type BlockIndexMeta struct { Height uint64 BlockTimestamp int64 BlockHash []byte TxIds []string RwSets []string BlockIndex }
BlockIndexMeta add next time @Description:
type BlockNormalized ¶ added in v2.4.0
type BlockNormalized struct { Block *commonPb.Block Meta *storePb.SerializedBlock // Block without Txs Txs []*commonPb.Transaction TxRWSets []*commonPb.TxRWSet ContractEvents []*commonPb.ContractEvent SerializationNormalized }
BlockNormalized contains block,txs.. and corresponding serialized data
func (*BlockNormalized) ToBlockWithRWSet ¶ added in v2.4.0
func (n *BlockNormalized) ToBlockWithRWSet() *storePb.BlockWithRWSet
ToBlockWithRWSet build a BlockWithRWSet from BlockNormalized.
type BlockNormalizer ¶ added in v2.4.0
type BlockNormalizer interface { // NormalizeBlock Organize blocks into a standard format for storage definition. NormalizeBlock(blockWithRWSet *storePb.BlockWithRWSet) (*BlockNormalized, error) // NormalizeFromSerialization restore normalized data from serialized data NormalizeFromSerialization(*SerializationNormalized) (*BlockNormalized, error) // // Serializer get the serializer used by BlockNormalizer, // so that users can deserialize the character data in BlockNormalized. Serializer() Serializer }
BlockNormalizer Organize blocks into a standard format for storage definition, and subsequent processes operate based on this format. It splits block data and serializes and deserializes the split data.
type BlockWithSerializedInfo ¶
type BlockWithSerializedInfo struct { BlockNormalized BlockIndex }
BlockWithSerializedInfo contains block,txs and corresponding serialized data @Description:
func NewBlockSerializedInfo ¶ added in v2.2.0
func NewBlockSerializedInfo() *BlockWithSerializedInfo
NewBlockSerializedInfo 创建一个序列化对象 @Description: @return *BlockWithSerializedInfo
func SerializeBlock ¶
func SerializeBlock(blockWithRWSet *storePb.BlockWithRWSet) ([]byte, *BlockWithSerializedInfo, error)
SerializeBlock serialized a BlockWithRWSet and return serialized data which combined as a BlockWithSerializedInfo @Description: @param blockWithRWSet @return []byte @return *BlockWithSerializedInfo @return error Deprecated: use NormalBlockNormalizer
func (*BlockWithSerializedInfo) ReSet ¶ added in v2.2.0
func (b *BlockWithSerializedInfo) ReSet()
ReSet 为sync.pool 重置 BlockWithSerializedInfo 状态时使用 @Description: @receiver b
func (*BlockWithSerializedInfo) SerializeEventTopicTable ¶ added in v2.2.0
func (b *BlockWithSerializedInfo) SerializeEventTopicTable(buf *proto.Buffer) error
SerializeEventTopicTable 序列化ContractEvents信息 @Description: @receiver b @param buf @return error
func (*BlockWithSerializedInfo) SerializeMeta ¶ added in v2.2.0
func (b *BlockWithSerializedInfo) SerializeMeta(buf *proto.Buffer) error
SerializeMeta 序列化meta信息,主要包括 header,dag,txids,additionalData数据 @Description: @receiver b @param buf @return error
func (*BlockWithSerializedInfo) SerializeTxRWSets ¶ added in v2.2.0
func (b *BlockWithSerializedInfo) SerializeTxRWSets(buf *proto.Buffer) error
SerializeTxRWSets 序列化读写集 @Description: @receiver b @param buf @return error
func (*BlockWithSerializedInfo) SerializeTxs ¶ added in v2.2.0
func (b *BlockWithSerializedInfo) SerializeTxs(buf *proto.Buffer) error
SerializeTxs 序列化txs信息 @Description: @receiver b @param buf @return error
type NormalBlockNormalizer ¶ added in v2.4.0
type NormalBlockNormalizer struct {
// contains filtered or unexported fields
}
NormalBlockNormalizer This is a general block normalizer. It uses the external serializer to serialize and deserialize the organization data, so that different serialization methods can be met in the future.
func NewNormalBlockNormalizer ¶ added in v2.4.0
func NewNormalBlockNormalizer(sinkCodec Serializer) *NormalBlockNormalizer
NewNormalBlockNormalizer constructs a NormalBlockNormalizer object using an externally provided serializer.
func NewNormalProtobufBlockNormalizer ¶ added in v2.4.0
func NewNormalProtobufBlockNormalizer() *NormalBlockNormalizer
NewNormalProtobufBlockNormalizer new normalizer with protobuf as serializer.
func (*NormalBlockNormalizer) NormalizeBlock ¶ added in v2.4.0
func (n *NormalBlockNormalizer) NormalizeBlock(blockWithRWSet *storePb.BlockWithRWSet) ( *BlockNormalized, error)
NormalizeBlock organizes blocks into a standard format for storage definition. 1. Split and organize block data. 2. Serialize the split data.
func (*NormalBlockNormalizer) NormalizeFromSerialization ¶ added in v2.4.0
func (n *NormalBlockNormalizer) NormalizeFromSerialization(normal *SerializationNormalized) (*BlockNormalized, error)
NormalizeFromSerialization restore normalized data from serialized data
func (*NormalBlockNormalizer) Serializer ¶ added in v2.4.0
func (n *NormalBlockNormalizer) Serializer() Serializer
Serializer get the serializer used by BlockNormalizer, so that users can deserialize the character data in BlockNormalized
Source Files
¶
- block_normalzer.go
- block_serialization.go
- kind_go118.go
- serializer.go