Documentation
¶
Overview ¶
Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- func CalculateSkipListLinks(blockNum uint64) []uint64
- func ComputeBlockBaseHash(block *types.Block) ([]byte, error)
- func ComputeBlockHash(block *types.Block) ([]byte, error)
- type BlockLocation
- func (*BlockLocation) Descriptor() ([]byte, []int)deprecated
- func (x *BlockLocation) GetFileChunkNum() uint64
- func (x *BlockLocation) GetLength() int64
- func (x *BlockLocation) GetOffset() int64
- func (*BlockLocation) ProtoMessage()
- func (x *BlockLocation) ProtoReflect() protoreflect.Message
- func (x *BlockLocation) Reset()
- func (x *BlockLocation) String() string
- type BlockTxIDs
- type Config
- type Store
- func (s *Store) AddSkipListLinks(block *types.Block) error
- func (s *Store) Close() error
- func (s *Store) Commit(block *types.Block) error
- func (s *Store) DoesTxIDExist(txID string) (bool, error)
- func (s *Store) Get(blockNumber uint64) (*types.Block, error)
- func (s *Store) GetAugmentedHeader(blockNumber uint64) (*types.AugmentedBlockHeader, error)
- func (s *Store) GetBaseHeaderHash(blockNumber uint64) ([]byte, error)
- func (s *Store) GetHash(blockNumber uint64) ([]byte, error)
- func (s *Store) GetHeader(blockNumber uint64) (*types.BlockHeader, error)
- func (s *Store) GetHeaderByHash(blockHash []byte) (*types.BlockHeader, error)
- func (s *Store) GetTxInfo(txID string) (*TxInfo, error)
- func (s *Store) GetValidationInfo(txID string) (*types.ValidationInfo, error)
- func (s *Store) Height() (uint64, error)
- type TxInfo
- func (*TxInfo) Descriptor() ([]byte, []int)deprecated
- func (x *TxInfo) GetBlockNumber() uint64
- func (x *TxInfo) GetTxIndex() uint64
- func (x *TxInfo) GetValidation() *types.ValidationInfo
- func (*TxInfo) ProtoMessage()
- func (x *TxInfo) ProtoReflect() protoreflect.Message
- func (x *TxInfo) Reset()
- func (x *TxInfo) String() string
Constants ¶
const (
SkipListBase = uint64(2)
)
Variables ¶
var ErrUnexpectedEndOfBlockfile = errors.New("unexpected end of blockfile")
ErrUnexpectedEndOfBlockfile error used to indicate an unexpected end of a file segment this can happen mainly if a crash occurs during appending a block and partial block contents get written towards the end of the file
var File_block_txs_id_proto protoreflect.FileDescriptor
var File_location_proto protoreflect.FileDescriptor
Functions ¶
func CalculateSkipListLinks ¶
func ComputeBlockBaseHash ¶
ComputeBlockBaseHash returns block hash before all validation and state data was updated. Currently block header base hash is considered block hash, because it contains all crypto related information, like Tx Merkle tree root and hash of previous block before validation as well
Types ¶
type BlockLocation ¶
type BlockLocation struct { FileChunkNum uint64 `protobuf:"varint,1,opt,name=file_chunk_num,json=fileChunkNum,proto3" json:"file_chunk_num,omitempty"` Offset int64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` Length int64 `protobuf:"varint,3,opt,name=length,proto3" json:"length,omitempty"` // contains filtered or unexported fields }
func (*BlockLocation) Descriptor
deprecated
func (*BlockLocation) Descriptor() ([]byte, []int)
Deprecated: Use BlockLocation.ProtoReflect.Descriptor instead.
func (*BlockLocation) GetFileChunkNum ¶
func (x *BlockLocation) GetFileChunkNum() uint64
func (*BlockLocation) GetLength ¶
func (x *BlockLocation) GetLength() int64
func (*BlockLocation) GetOffset ¶
func (x *BlockLocation) GetOffset() int64
func (*BlockLocation) ProtoMessage ¶
func (*BlockLocation) ProtoMessage()
func (*BlockLocation) ProtoReflect ¶ added in v0.2.6
func (x *BlockLocation) ProtoReflect() protoreflect.Message
func (*BlockLocation) Reset ¶
func (x *BlockLocation) Reset()
func (*BlockLocation) String ¶
func (x *BlockLocation) String() string
type BlockTxIDs ¶
type BlockTxIDs struct { TxIds []string `protobuf:"bytes,1,rep,name=tx_ids,json=txIds,proto3" json:"tx_ids,omitempty"` // contains filtered or unexported fields }
func (*BlockTxIDs) Descriptor
deprecated
func (*BlockTxIDs) Descriptor() ([]byte, []int)
Deprecated: Use BlockTxIDs.ProtoReflect.Descriptor instead.
func (*BlockTxIDs) GetTxIds ¶
func (x *BlockTxIDs) GetTxIds() []string
func (*BlockTxIDs) ProtoMessage ¶
func (*BlockTxIDs) ProtoMessage()
func (*BlockTxIDs) ProtoReflect ¶ added in v0.2.6
func (x *BlockTxIDs) ProtoReflect() protoreflect.Message
func (*BlockTxIDs) Reset ¶
func (x *BlockTxIDs) Reset()
func (*BlockTxIDs) String ¶
func (x *BlockTxIDs) String() string
type Config ¶
type Config struct { StoreDir string Logger *logger.SugarLogger }
Config holds the configuration of a block store
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store maintains a chain of blocks in an append-only filesystem
func (*Store) AddSkipListLinks ¶
AddSkipListLinks calculated and add skip list block number to the block
func (*Store) DoesTxIDExist ¶
DoesTxIDExist returns true if any of the committed block has a transaction with the given txID. Otherwise, it returns false
func (*Store) GetAugmentedHeader ¶
func (s *Store) GetAugmentedHeader(blockNumber uint64) (*types.AugmentedBlockHeader, error)
GetAugmentedHeader returns block header with slice of block tx ids
func (*Store) GetBaseHeaderHash ¶
GetBaseHeaderHash returns block header base hash by block number
func (*Store) GetHeader ¶
func (s *Store) GetHeader(blockNumber uint64) (*types.BlockHeader, error)
GetHeader returns block header by block number, operation should be faster that regular Get, because it requires only one db access, without file reads
func (*Store) GetHeaderByHash ¶
func (s *Store) GetHeaderByHash(blockHash []byte) (*types.BlockHeader, error)
GetHeaderByHash returns block header by block hash, used for travel in Merkle list or Merkle skip list
func (*Store) GetValidationInfo ¶
func (s *Store) GetValidationInfo(txID string) (*types.ValidationInfo, error)
GetValidationInfo returns the validation info associated with a given txID
type TxInfo ¶ added in v0.2.5
type TxInfo struct { BlockNumber uint64 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` TxIndex uint64 `protobuf:"varint,2,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` Validation *types.ValidationInfo `protobuf:"bytes,3,opt,name=validation,proto3" json:"validation,omitempty"` // contains filtered or unexported fields }
func (*TxInfo) Descriptor
deprecated
added in
v0.2.5
func (*TxInfo) GetBlockNumber ¶ added in v0.2.5
func (*TxInfo) GetTxIndex ¶ added in v0.2.5
func (*TxInfo) GetValidation ¶ added in v0.2.5
func (x *TxInfo) GetValidation() *types.ValidationInfo
func (*TxInfo) ProtoMessage ¶ added in v0.2.5
func (*TxInfo) ProtoMessage()
func (*TxInfo) ProtoReflect ¶ added in v0.2.6
func (x *TxInfo) ProtoReflect() protoreflect.Message