hybridblkstorage

package
v0.0.0-...-7491e2d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
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"
	// CidIndexDir is the name of the directory containing all cid indexes across ledgers.
	CidIndexDir = "cidIndex"
)

Variables

View Source
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

View Source
var ErrUnexpectedEndOfDfsBlockfile = errors.New("unexpected end of dfs blockfile")

ErrUnexpectedEndOfDfsBlockfile 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

Functions

func ClearPreResetHeight

func ClearPreResetHeight(blockStorageDir string, ledgerIDs []string) error

ClearPreResetHeight deletes the files that contain the last recorded reset heights for the specified ledgers

func DeleteBlockStoreIndex

func DeleteBlockStoreIndex(blockStorageDir string) error

DeleteBlockStoreIndex deletes block store index file

func LoadPreResetHeight

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

LoadPreResetHeight searches the preResetHeight files for the specified ledgers and returns a map of channelname to the last recorded block height during one of the reset operations.

func NewProvider

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

NewProvider constructs a filesystem based block store provider

func ResetBlockStore

func ResetBlockStore(blockStorageDir string) error

ResetBlockStore drops the block storage index and truncates the blocks files for all channels/ledgers to genesis blocks

func Rollback

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

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

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

Types

type Conf

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

Conf encapsulates all the configurations for `FsBlockStore`

func NewConf

func NewConf(blockStorageDir string, maxBlockfileSize int) *Conf

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

type HybridBlockstoreProvider

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

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

func (*HybridBlockstoreProvider) Close

func (p *HybridBlockstoreProvider) Close()

Close closes the HybridBlockstoreProvider

func (*HybridBlockstoreProvider) CreateBlockStore

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

CreateBlockStore simply calls OpenBlockStore

func (*HybridBlockstoreProvider) Exists

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

Exists tells whether the BlockStore with given id exists

func (*HybridBlockstoreProvider) List

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

List lists the ids of the existing ledgers

func (*HybridBlockstoreProvider) OpenBlockStore

func (p *HybridBlockstoreProvider) 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL