Documentation ¶
Index ¶
- Constants
- Variables
- func ClearPreResetHeight(blockStorageDir string, ledgerIDs []string) error
- func DeleteBlockStoreIndex(blockStorageDir string) error
- func LoadPreResetHeight(blockStorageDir string, ledgerIDs []string) (map[string]uint64, error)
- func NewProvider(conf *Conf, indexConfig *blkstorage.IndexConfig, ...) (blkstorage.BlockStoreProvider, error)
- func ResetBlockStore(blockStorageDir string) error
- func Rollback(blockStorageDir, ledgerID string, targetBlockNum uint64, ...) error
- func ValidateRollbackParams(blockStorageDir, ledgerID string, targetBlockNum uint64) error
- type Conf
- type FsBlockstoreProvider
- func (p *FsBlockstoreProvider) Close()
- func (p *FsBlockstoreProvider) CreateBlockStore(ledgerid string) (blkstorage.BlockStore, error)
- func (p *FsBlockstoreProvider) Exists(ledgerid string) (bool, error)
- func (p *FsBlockstoreProvider) List() ([]string, error)
- func (p *FsBlockstoreProvider) OpenBlockStore(ledgerid string) (blkstorage.BlockStore, error)
Constants ¶
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" )
Variables ¶
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 ClearPreResetHeight ¶ added in v1.4.2
ClearPreResetHeight deletes the files that contain the last recorded reset heights for the specified ledgers
func DeleteBlockStoreIndex ¶
DeleteBlockStoreIndex deletes block store index file
func LoadPreResetHeight ¶ added in v1.4.2
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) (blkstorage.BlockStoreProvider, error)
NewProvider constructs a filesystem based block store provider
func ResetBlockStore ¶ added in v1.4.2
ResetBlockStore drops the block storage index and truncates the blocks files for all channels/ledgers to genesis blocks
func Rollback ¶ added in v1.4.2
func Rollback(blockStorageDir, ledgerID string, targetBlockNum uint64, indexConfig *blkstorage.IndexConfig) error
Rollback reverts changes made to the block store beyond a given block number.
Types ¶
type Conf ¶
type Conf struct {
// contains filtered or unexported fields
}
Conf encapsulates all the configurations for `FsBlockStore`
type FsBlockstoreProvider ¶
type FsBlockstoreProvider struct {
// contains filtered or unexported fields
}
FsBlockstoreProvider provides handle to block storage - this is not thread-safe
func (*FsBlockstoreProvider) Close ¶
func (p *FsBlockstoreProvider) Close()
Close closes the FsBlockstoreProvider
func (*FsBlockstoreProvider) CreateBlockStore ¶
func (p *FsBlockstoreProvider) CreateBlockStore(ledgerid string) (blkstorage.BlockStore, error)
CreateBlockStore simply calls OpenBlockStore
func (*FsBlockstoreProvider) Exists ¶
func (p *FsBlockstoreProvider) Exists(ledgerid string) (bool, error)
Exists tells whether the BlockStore with given id exists
func (*FsBlockstoreProvider) List ¶
func (p *FsBlockstoreProvider) List() ([]string, error)
List lists the ids of the existing ledgers
func (*FsBlockstoreProvider) OpenBlockStore ¶
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