...

Package ledgerstorage

import "github.com/hyperledger/fabric/core/ledger/ledgerstorage"
Overview
Index

Overview ▾

Index ▾

func LoadPreResetHeight(blockstorePath string) (map[string]uint64, error)
func ResetBlockStore(blockstorePath string) error
func Rollback(blockstorePath, ledgerID string, blockNum uint64) error
func ValidateRollbackParams(blockstorePath, ledgerID string, blockNum uint64) error
type Provider
    func NewProvider(metricsProvider metrics.Provider) *Provider
    func (p *Provider) Close()
    func (p *Provider) Exists(ledgerID string) (bool, error)
    func (p *Provider) Open(ledgerid string) (*Store, error)
type Store
    func (s *Store) CommitPvtDataOfOldBlocks(blocksPvtData map[uint64][]*ledger.TxPvtData) error
    func (s *Store) CommitWithPvtData(blockAndPvtdata *ledger.BlockAndPvtData) error
    func (s *Store) DoesPvtDataInfoExist(blockNum uint64) (bool, error)
    func (s *Store) GetLastUpdatedOldBlocksPvtData() (map[uint64][]*ledger.TxPvtData, error)
    func (s *Store) GetMissingPvtDataInfoForMostRecentBlocks(maxBlock int) (ledger.MissingPvtDataInfo, error)
    func (s *Store) GetPvtDataAndBlockByNum(blockNum uint64, filter ledger.PvtNsCollFilter) (*ledger.BlockAndPvtData, error)
    func (s *Store) GetPvtDataByNum(blockNum uint64, filter ledger.PvtNsCollFilter) ([]*ledger.TxPvtData, error)
    func (s *Store) Init(btlPolicy pvtdatapolicy.BTLPolicy)
    func (s *Store) IsPvtStoreAheadOfBlockStore() bool
    func (s *Store) ProcessCollsEligibilityEnabled(committingBlk uint64, nsCollMap map[string][]string) error
    func (s *Store) ResetLastUpdatedOldBlocksList() error

Package files

store.go

func LoadPreResetHeight

func LoadPreResetHeight(blockstorePath string) (map[string]uint64, error)

LoadPreResetHeight returns the pre reset height.

func ResetBlockStore

func ResetBlockStore(blockstorePath string) error

ResetBlockStore resets all ledgers to the genesis block.

func Rollback

func Rollback(blockstorePath, ledgerID string, blockNum uint64) error

Rollback reverts changes made to the block store beyond a given block number.

func ValidateRollbackParams

func ValidateRollbackParams(blockstorePath, ledgerID string, blockNum uint64) error

ValidateRollbackParams performs necessary validation on the input given for the rollback operation.

type Provider

Provider encapusaltes two providers 1) block store provider and 2) and pvt data store provider

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

func NewProvider

func NewProvider(metricsProvider metrics.Provider) *Provider

NewProvider returns the handle to the provider

func (*Provider) Close

func (p *Provider) Close()

Close closes the provider

func (*Provider) Exists

func (p *Provider) Exists(ledgerID string) (bool, error)

Exists checks whether the ledgerID already presents

func (*Provider) Open

func (p *Provider) Open(ledgerid string) (*Store, error)

Open opens the store

type Store

Store encapsulates two stores 1) block store and pvt data store

type Store struct {
    blkstorage.BlockStore
    // contains filtered or unexported fields
}

func (*Store) CommitPvtDataOfOldBlocks

func (s *Store) CommitPvtDataOfOldBlocks(blocksPvtData map[uint64][]*ledger.TxPvtData) error

CommitPvtDataOfOldBlocks commits the pvtData of old blocks

func (*Store) CommitWithPvtData

func (s *Store) CommitWithPvtData(blockAndPvtdata *ledger.BlockAndPvtData) error

CommitWithPvtData commits the block and the corresponding pvt data in an atomic operation

func (*Store) DoesPvtDataInfoExist

func (s *Store) DoesPvtDataInfoExist(blockNum uint64) (bool, error)

DoesPvtDataInfoExist returns true when (1) the ledger has pvtdata associated with the given block number (or) (2) a few or all pvtdata associated with the given block number is missing but the

missing info is recorded in the ledger (or)

(3) the block is committed does not contain any pvtData.

func (*Store) GetLastUpdatedOldBlocksPvtData

func (s *Store) GetLastUpdatedOldBlocksPvtData() (map[uint64][]*ledger.TxPvtData, error)

GetLastUpdatedOldBlocksPvtData invokes the function on underlying pvtdata store

func (*Store) GetMissingPvtDataInfoForMostRecentBlocks

func (s *Store) GetMissingPvtDataInfoForMostRecentBlocks(maxBlock int) (ledger.MissingPvtDataInfo, error)

GetMissingPvtDataInfoForMostRecentBlocks invokes the function on underlying pvtdata store

func (*Store) GetPvtDataAndBlockByNum

func (s *Store) GetPvtDataAndBlockByNum(blockNum uint64, filter ledger.PvtNsCollFilter) (*ledger.BlockAndPvtData, error)

GetPvtDataAndBlockByNum returns the block and the corresponding pvt data. The pvt data is filtered by the list of 'collections' supplied

func (*Store) GetPvtDataByNum

func (s *Store) GetPvtDataByNum(blockNum uint64, filter ledger.PvtNsCollFilter) ([]*ledger.TxPvtData, error)

GetPvtDataByNum returns only the pvt data corresponding to the given block number The pvt data is filtered by the list of 'ns/collections' supplied in the filter A nil filter does not filter any results

func (*Store) Init

func (s *Store) Init(btlPolicy pvtdatapolicy.BTLPolicy)

Init initializes store with essential configurations

func (*Store) IsPvtStoreAheadOfBlockStore

func (s *Store) IsPvtStoreAheadOfBlockStore() bool

IsPvtStoreAheadOfBlockStore returns true when the pvtStore height is greater than the blockstore height. Otherwise, it returns false.

func (*Store) ProcessCollsEligibilityEnabled

func (s *Store) ProcessCollsEligibilityEnabled(committingBlk uint64, nsCollMap map[string][]string) error

ProcessCollsEligibilityEnabled invokes the function on underlying pvtdata store

func (*Store) ResetLastUpdatedOldBlocksList

func (s *Store) ResetLastUpdatedOldBlocksList() error

ResetLastUpdatedOldBlocksList invokes the function on underlying pvtdata store