{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package blkstorage\n\n## Constants\n\n```go\nconst (\n\tIndexableAttrBlockNum         = IndexableAttr(\"BlockNum\")\n\tIndexableAttrBlockHash        = IndexableAttr(\"BlockHash\")\n\tIndexableAttrTxID             = IndexableAttr(\"TxID\")\n\tIndexableAttrBlockNumTranNum  = IndexableAttr(\"BlockNumTranNum\")\n\tIndexableAttrBlockTxID        = IndexableAttr(\"BlockTxID\")\n\tIndexableAttrTxValidationCode = IndexableAttr(\"TxValidationCode\")\n)\n```\nconstants for indexable attributes\n\n## Variables\n\n```go\nvar (\n\t// ErrNotFoundInIndex is used to indicate missing entry in the index\n\tErrNotFoundInIndex = l.NotFoundInIndexErr(\"\")\n\n\t// ErrAttrNotIndexed is used to indicate that an attribute is not indexed\n\tErrAttrNotIndexed = errors.New(\"attribute not indexed\")\n)\n```\n\n## Types\n\n```go\ntype BlockStore interface {\n\tAddBlock(block *common.Block) error\n\tGetBlockchainInfo() (*common.BlockchainInfo, error)\n\tRetrieveBlocks(startNum uint64) (ledger.ResultsIterator, error)\n\tRetrieveBlockByHash(blockHash []byte) (*common.Block, error)\n\tRetrieveBlockByNumber(blockNum uint64) (*common.Block, error) // blockNum of  math.MaxUint64 will return last block\n\tRetrieveTxByID(txID string) (*common.Envelope, error)\n\tRetrieveTxByBlockNumTranNum(blockNum uint64, tranNum uint64) (*common.Envelope, error)\n\tRetrieveBlockByTxID(txID string) (*common.Block, error)\n\tRetrieveTxValidationCodeByTxID(txID string) (peer.TxValidationCode, error)\n\tShutdown()\n}\n```\nBlockStore - 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\n\n```go\ntype BlockStoreProvider interface {\n\tCreateBlockStore(ledgerid string) (BlockStore, error)\n\tOpenBlockStore(ledgerid string) (BlockStore, error)\n\tExists(ledgerid string) (bool, error)\n\tList() ([]string, error)\n\tClose()\n}\n```\nBlockStoreProvider provides an handle to a BlockStore\n\n```go\ntype IndexConfig struct {\n\tAttrsToIndex []IndexableAttr\n}\n```\nIndexConfig - a configuration that includes a list of attributes that should be indexed\n\n```go\ntype IndexableAttr string\n```\nIndexableAttr represents an indexable attribute\n\n","path":"github.com/eric-erki/https-hyperledger.org/common/ledger/blkstorage","name":"blkstorage","synopsis":"","isRedistributable":true}
