snapshot

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0, BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSnapshot

func CreateSnapshot(filePath string,
	headerProd HeaderProducerFunc,
	utxoStatesProd UTXOStatesProducerFunc,
	epochDiffsProd EpochDiffProducerFunc) (*ledger.SnapshotHeader, error)

CreateSnapshot creates a snapshot file to the given file path.

func LoadSnapshot

func LoadSnapshot(filePath string,
	headerConsumer HeaderConsumerFunc,
	outputWithMetadataConsumer UTXOStatesConsumerFunc,
	epochDiffsConsumer EpochDiffsConsumerFunc) (err error)

LoadSnapshot loads a snapshot file from the given file path. Contents in a snapshot file will not be written to a snapshot struct in case blowing up the memory, they should be proccessed in consumer functions.

Types

type EpochDiffProducerFunc

type EpochDiffProducerFunc func() (epochDiffs map[epoch.Index]*ledger.EpochDiff, err error)

EpochDiffProducerFunc is the type of function that produces EpochDiff when taking a snapshot.

func NewEpochDiffsProducer

func NewEpochDiffsProducer(lastConfirmedEpoch, latestCommitableEpoch epoch.Index, nmgr *notarization.Manager) EpochDiffProducerFunc

NewEpochDiffsProducer returns a OutputWithMetadataProducerFunc that provide OutputWithMetadatas from the ledger.

type EpochDiffsConsumerFunc

type EpochDiffsConsumerFunc func(header *ledger.SnapshotHeader, epochDiffs map[epoch.Index]*ledger.EpochDiff)

EpochDiffsConsumerFunc is the type of function that consumes EpochDiff when loading a snapshot.

type HeaderConsumerFunc

type HeaderConsumerFunc func(header *ledger.SnapshotHeader)

HeaderConsumerFunc is the type of function that consumes snapshot header when loading a snapshot.

type HeaderProducerFunc

type HeaderProducerFunc func() (header *ledger.SnapshotHeader, err error)

HeaderProducerFunc is the type of function that produces snapshot header when taking a snapshot.

type Snapshot

type Snapshot struct {
	LedgerSnapshot *ledger.Snapshot
}

Snapshot contains the data to be put in a snapshot file.

type UTXOStatesConsumerFunc

type UTXOStatesConsumerFunc func(outputWithMetadatas []*ledger.OutputWithMetadata)

UTXOStatesConsumerFunc is the type of function that consumes OutputWithMetadatas when loading a snapshot.

type UTXOStatesProducerFunc

type UTXOStatesProducerFunc func() (outputWithMetadata *ledger.OutputWithMetadata)

UTXOStatesProducerFunc is the type of function that produces OutputWithMetadatas when taking a snapshot.

func NewLedgerUTXOStatesProducer

func NewLedgerUTXOStatesProducer(lastConfirmedEpoch epoch.Index, nmgr *notarization.Manager) UTXOStatesProducerFunc

NewLedgerUTXOStatesProducer returns a OutputWithMetadataProducerFunc that provide OutputWithMetadatas from the ledger.

Jump to

Keyboard shortcuts

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