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)
- func (m *BlockLocation) GetFileChunkNum() uint64
- func (m *BlockLocation) GetLength() int64
- func (m *BlockLocation) GetOffset() int64
- func (*BlockLocation) ProtoMessage()
- func (m *BlockLocation) Reset()
- func (m *BlockLocation) String() string
- func (m *BlockLocation) XXX_DiscardUnknown()
- func (m *BlockLocation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *BlockLocation) XXX_Merge(src proto.Message)
- func (m *BlockLocation) XXX_Size() int
- func (m *BlockLocation) XXX_Unmarshal(b []byte) error
- type BlockTxIDs
- func (*BlockTxIDs) Descriptor() ([]byte, []int)
- func (m *BlockTxIDs) GetTxIds() []string
- func (*BlockTxIDs) ProtoMessage()
- func (m *BlockTxIDs) Reset()
- func (m *BlockTxIDs) String() string
- func (m *BlockTxIDs) XXX_DiscardUnknown()
- func (m *BlockTxIDs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *BlockTxIDs) XXX_Merge(src proto.Message)
- func (m *BlockTxIDs) XXX_Size() int
- func (m *BlockTxIDs) XXX_Unmarshal(b []byte) error
- 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) GetValidationInfo(txID string) (*types.ValidationInfo, error)
- func (s *Store) Height() (uint64, error)
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
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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*BlockLocation) Descriptor ¶
func (*BlockLocation) Descriptor() ([]byte, []int)
func (*BlockLocation) GetFileChunkNum ¶
func (m *BlockLocation) GetFileChunkNum() uint64
func (*BlockLocation) GetLength ¶
func (m *BlockLocation) GetLength() int64
func (*BlockLocation) GetOffset ¶
func (m *BlockLocation) GetOffset() int64
func (*BlockLocation) ProtoMessage ¶
func (*BlockLocation) ProtoMessage()
func (*BlockLocation) Reset ¶
func (m *BlockLocation) Reset()
func (*BlockLocation) String ¶
func (m *BlockLocation) String() string
func (*BlockLocation) XXX_DiscardUnknown ¶
func (m *BlockLocation) XXX_DiscardUnknown()
func (*BlockLocation) XXX_Marshal ¶
func (m *BlockLocation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*BlockLocation) XXX_Merge ¶
func (m *BlockLocation) XXX_Merge(src proto.Message)
func (*BlockLocation) XXX_Size ¶
func (m *BlockLocation) XXX_Size() int
func (*BlockLocation) XXX_Unmarshal ¶
func (m *BlockLocation) XXX_Unmarshal(b []byte) error
type BlockTxIDs ¶
type BlockTxIDs struct { TxIds []string `protobuf:"bytes,1,rep,name=tx_ids,json=txIds,proto3" json:"tx_ids,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*BlockTxIDs) Descriptor ¶
func (*BlockTxIDs) Descriptor() ([]byte, []int)
func (*BlockTxIDs) GetTxIds ¶
func (m *BlockTxIDs) GetTxIds() []string
func (*BlockTxIDs) ProtoMessage ¶
func (*BlockTxIDs) ProtoMessage()
func (*BlockTxIDs) Reset ¶
func (m *BlockTxIDs) Reset()
func (*BlockTxIDs) String ¶
func (m *BlockTxIDs) String() string
func (*BlockTxIDs) XXX_DiscardUnknown ¶
func (m *BlockTxIDs) XXX_DiscardUnknown()
func (*BlockTxIDs) XXX_Marshal ¶
func (m *BlockTxIDs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*BlockTxIDs) XXX_Merge ¶
func (m *BlockTxIDs) XXX_Merge(src proto.Message)
func (*BlockTxIDs) XXX_Size ¶
func (m *BlockTxIDs) XXX_Size() int
func (*BlockTxIDs) XXX_Unmarshal ¶
func (m *BlockTxIDs) XXX_Unmarshal(b []byte) error
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