fabric: github.com/hyperledger/fabric/common/ledger/blkstorage/fsblkstorage Index | Files

package fsblkstorage

import "github.com/hyperledger/fabric/common/ledger/blkstorage/fsblkstorage"


Package Files

block_serialization.go block_stream.go blockfile_helper.go blockfile_mgr.go blockfile_rw.go blockindex.go blocks_itr.go config.go fs_blockstore.go fs_blockstore_provider.go metrics.go reset.go rollback.go


const (
    // ChainsDir is the name of the directory containing the channel ledgers.
    ChainsDir = "chains"
    // IndexDir is the name of the directory containing all block indexes across ledgers.
    IndexDir = "index"


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 appening a block and partial block contents get written towards the end of the file

func ClearPreResetHeight Uses

func ClearPreResetHeight(blockStorageDir string) error

func LoadPreResetHeight Uses

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

func NewProvider Uses

func NewProvider(conf *Conf, indexConfig *blkstorage.IndexConfig, metricsProvider metrics.Provider) blkstorage.BlockStoreProvider

NewProvider constructs a filesystem based block store provider

func ResetBlockStore Uses

func ResetBlockStore(blockStorageDir string) error

func Rollback Uses

func Rollback(blockStorageDir, ledgerID string, targetBlockNum uint64, indexConfig *blkstorage.IndexConfig) error

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

func ValidateRollbackParams Uses

func ValidateRollbackParams(blockStorageDir, ledgerID string, targetBlockNum uint64) error

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

type Conf Uses

type Conf struct {
    // contains filtered or unexported fields

Conf encapsulates all the configurations for `FsBlockStore`

func NewConf Uses

func NewConf(blockStorageDir string, maxBlockfileSize int) *Conf

NewConf constructs new `Conf`. blockStorageDir is the top level folder under which `FsBlockStore` manages its data

type FsBlockstoreProvider Uses

type FsBlockstoreProvider struct {
    // contains filtered or unexported fields

FsBlockstoreProvider provides handle to block storage - this is not thread-safe

func (*FsBlockstoreProvider) Close Uses

func (p *FsBlockstoreProvider) Close()

Close closes the FsBlockstoreProvider

func (*FsBlockstoreProvider) CreateBlockStore Uses

func (p *FsBlockstoreProvider) CreateBlockStore(ledgerid string) (blkstorage.BlockStore, error)

CreateBlockStore simply calls OpenBlockStore

func (*FsBlockstoreProvider) Exists Uses

func (p *FsBlockstoreProvider) Exists(ledgerid string) (bool, error)

Exists tells whether the BlockStore with given id exists

func (*FsBlockstoreProvider) List Uses

func (p *FsBlockstoreProvider) List() ([]string, error)

List lists the ids of the existing ledgers

func (*FsBlockstoreProvider) OpenBlockStore Uses

func (p *FsBlockstoreProvider) OpenBlockStore(ledgerid string) (blkstorage.BlockStore, error)

OpenBlockStore opens a block store for given ledgerid. If a blockstore is not existing, this method creates one This method should be invoked only once for a particular ledgerid

Package fsblkstorage imports 27 packages (graph) and is imported by 15 packages. Updated 2019-07-31. Refresh now. Tools for package owners.