Documentation ¶
Index ¶
- func CreateSnapshot(filePath string, headerProd HeaderProducerFunc, ...) (*ledger.SnapshotHeader, error)
- func LoadSnapshot(filePath string, headerConsumer HeaderConsumerFunc, ...) (err error)
- type EpochDiffProducerFunc
- type EpochDiffsConsumerFunc
- type HeaderConsumerFunc
- type HeaderProducerFunc
- type Snapshot
- type UTXOStatesConsumerFunc
- type UTXOStatesProducerFunc
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 ¶
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 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.