fsblkstorage

package
v0.0.0-...-c410d66 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2017 License: Apache-2.0 Imports: 20 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"
)

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

Functions

func NewProvider

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

NewProvider constructs a filesystem based block store provider

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 `FsBlockStore` manages its data

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

Jump to

Keyboard shortcuts

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