blkstorage

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: Apache-2.0 Imports: 5 Imported by: 1,282

Documentation

Index

Constants

View Source
const (
	IndexableAttrBlockNum        = IndexableAttr("BlockNum")
	IndexableAttrBlockHash       = IndexableAttr("BlockHash")
	IndexableAttrTxID            = IndexableAttr("TxID")
	IndexableAttrBlockNumTranNum = IndexableAttr("BlockNumTranNum")
)

constants for indexable attributes

Variables

View Source
var (
	// ErrNotFoundInIndex is used to indicate missing entry in the index
	ErrNotFoundInIndex = l.NotFoundInIndexErr("")

	// ErrAttrNotIndexed is used to indicate that an attribute is not indexed
	ErrAttrNotIndexed = errors.New("attribute not indexed")
)

Functions

This section is empty.

Types

type BlockStore

type BlockStore interface {
	AddBlock(block *common.Block) error
	GetBlockchainInfo() (*common.BlockchainInfo, error)
	RetrieveBlocks(startNum uint64) (ledger.ResultsIterator, error)
	RetrieveBlockByHash(blockHash []byte) (*common.Block, error)
	RetrieveBlockByNumber(blockNum uint64) (*common.Block, error) // blockNum of  math.MaxUint64 will return last block
	RetrieveTxByID(txID string) (*common.Envelope, error)
	RetrieveTxByBlockNumTranNum(blockNum uint64, tranNum uint64) (*common.Envelope, error)
	RetrieveBlockByTxID(txID string) (*common.Block, error)
	RetrieveTxValidationCodeByTxID(txID string) (peer.TxValidationCode, error)
	Shutdown()
}

BlockStore - an interface for persisting and retrieving blocks An implementation of this interface is expected to take an argument of type `IndexConfig` which configures the block store on what items should be indexed

type BlockStoreProvider

type BlockStoreProvider interface {
	CreateBlockStore(ledgerid string) (BlockStore, error)
	OpenBlockStore(ledgerid string) (BlockStore, error)
	Exists(ledgerid string) (bool, error)
	List() ([]string, error)
	Close()
}

BlockStoreProvider provides an handle to a BlockStore

type IndexConfig

type IndexConfig struct {
	AttrsToIndex []IndexableAttr
}

IndexConfig - a configuration that includes a list of attributes that should be indexed

func (*IndexConfig) Contains

func (c *IndexConfig) Contains(indexableAttr IndexableAttr) bool

Contains returns true iff the supplied parameter is present in the IndexConfig.AttrsToIndex

type IndexableAttr

type IndexableAttr string

IndexableAttr represents an indexable attribute

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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