fabric: github.com/hyperledger/fabric/core/ledger/ledgermgmt Index | Files | Directories

package ledgermgmt

import "github.com/hyperledger/fabric/core/ledger/ledgermgmt"


Package Files



var ErrLedgerAlreadyOpened = errors.New("ledger already opened")

ErrLedgerAlreadyOpened is thrown by a CreateLedger call if a ledger with the given id is already opened

var ErrLedgerMgmtNotInitialized = errors.New("ledger mgmt should be initialized before using")

ErrLedgerMgmtNotInitialized is thrown when ledger mgmt is used before initializing this

type Initializer Uses

type Initializer struct {
    CustomTxProcessors              map[common.HeaderType]ledger.CustomTxProcessor
    StateListeners                  []ledger.StateListener
    DeployedChaincodeInfoProvider   ledger.DeployedChaincodeInfoProvider
    MembershipInfoProvider          ledger.MembershipInfoProvider
    ChaincodeLifecycleEventProvider ledger.ChaincodeLifecycleEventProvider
    MetricsProvider                 metrics.Provider
    HealthCheckRegistry             ledger.HealthCheckRegistry
    Config                          *ledger.Config
    Hasher                          ledger.Hasher
    EbMetadataProvider              MetadataProvider

Initializer encapsulates all the external dependencies for the ledger module

type LedgerMgr Uses

type LedgerMgr struct {
    // contains filtered or unexported fields

LedgerMgr manages ledgers for all channels

func NewLedgerMgr Uses

func NewLedgerMgr(initializer *Initializer) *LedgerMgr

NewLedgerMgr creates a new LedgerMgr

func (*LedgerMgr) Close Uses

func (m *LedgerMgr) Close()

Close closes all the opened ledgers and any resources held for ledger management

func (*LedgerMgr) CreateLedger Uses

func (m *LedgerMgr) CreateLedger(id string, genesisBlock *common.Block) (ledger.PeerLedger, error)

CreateLedger creates a new ledger with the given genesis block. This function guarantees that the creation of ledger and committing the genesis block would an atomic action The chain id retrieved from the genesis block is treated as a ledger id

func (*LedgerMgr) GetLedgerIDs Uses

func (m *LedgerMgr) GetLedgerIDs() ([]string, error)

GetLedgerIDs returns the ids of the ledgers created

func (*LedgerMgr) OpenLedger Uses

func (m *LedgerMgr) OpenLedger(id string) (ledger.PeerLedger, error)

OpenLedger returns a ledger for the given id

type MetadataProvider Uses

type MetadataProvider interface {
    PackageMetadata(ccid string) ([]byte, error)



Package ledgermgmt imports 11 packages (graph) and is imported by 32 packages. Updated 2019-11-17. Refresh now. Tools for package owners.