confighistory

package
v0.0.0-...-579b097 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mgr

type Mgr struct {
	// contains filtered or unexported fields
}

Mgr manages the history of configurations such as chaincode's collection configurations. It should be registered as a state listener. The state listener builds the history.

func NewMgr

func NewMgr(dbPath string, ccInfoProvider ledger.DeployedChaincodeInfoProvider) (*Mgr, error)

NewMgr constructs an instance that implements interface `Mgr`

func (*Mgr) Close

func (m *Mgr) Close()

Close implements the function in the interface 'Mgr'

func (*Mgr) Drop

func (m *Mgr) Drop(ledgerid string) error

Drop drops channel-specific data from the config history db

func (*Mgr) GetRetriever

func (m *Mgr) GetRetriever(ledgerID string) *Retriever

GetRetriever returns an implementation of `ledger.ConfigHistoryRetriever` for the given ledger id.

func (*Mgr) HandleStateUpdates

func (m *Mgr) HandleStateUpdates(trigger *ledger.StateUpdateTrigger) error

HandleStateUpdates implements function from the interface ledger.StateListener In this implementation, the latest collection config package is retrieved via ledger.DeployedChaincodeInfoProvider and is persisted as a separate entry in a separate db. The composite key for the entry is a tuple of <blockNum, namespace, key>

func (*Mgr) ImportFromSnapshot

func (m *Mgr) ImportFromSnapshot(ledgerID string, dir string) error

ImportConfigHistory imports the collection config history associated with a given ledgerID from the snapshot files present in the dir

func (*Mgr) Initialize

func (m *Mgr) Initialize(ledgerID string, qe ledger.SimpleQueryExecutor) error

Initialize implements function from the interface ledger.StateListener

func (*Mgr) InterestedInNamespaces

func (m *Mgr) InterestedInNamespaces() []string

InterestedInNamespaces implements function from the interface ledger.StateListener

func (*Mgr) Name

func (m *Mgr) Name() string

Name returns the name of the listener

func (*Mgr) StateCommitDone

func (m *Mgr) StateCommitDone(ledgerID string)

StateCommitDone implements function from the interface ledger.StateListener

type Retriever

type Retriever struct {
	// contains filtered or unexported fields
}

Retriever helps consumer retrieve collection config history

func (*Retriever) ExportConfigHistory

func (r *Retriever) ExportConfigHistory(dir string, newHashFunc snapshot.NewHashFunc) (map[string][]byte, error)

ExportConfigHistory exports configuration history from the confighistoryDB to a file. Currently, we store only one type of configuration in the db, i.e., private data collection configuration. We write the full key and value stored in the database as is to the file. Though we could decode the key and write a proto message with exact ns, key, block number, and collection config, we store the full key and value to avoid unnecessary encoding and decoding of proto messages. The key format stored in db is "s" + ns + byte(0) + key + "~collection" + byte(0) + blockNum. As we store the key as is, we store 13 extra bytes. For a million records, it would add only 12 MB overhead. Note that the protobuf also adds some extra bytes. Further, the collection config namespace is not expected to have millions of entries.

func (*Retriever) MostRecentCollectionConfigBelow

func (r *Retriever) MostRecentCollectionConfigBelow(blockNum uint64, chaincodeName string) (*ledger.CollectionConfigInfo, error)

MostRecentCollectionConfigBelow implements function from the interface ledger.ConfigHistoryRetriever

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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