snapshot

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0, BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSnapshot

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

CreateSnapshot creates a snapshot file to the given file path.

func LoadSnapshot

func LoadSnapshot(filePath string,
	headerConsumer HeaderConsumerFunc,
	sepsConsumer SolidEntryPointsConsumerFunc,
	outputWithMetadataConsumer UTXOStatesConsumerFunc,
	epochDiffsConsumer EpochDiffsConsumerFunc,
	activityLogConsumer ActivityLogConsumerFunc) (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 ActivityLogConsumerFunc added in v0.9.5

type ActivityLogConsumerFunc func(activityLogs epoch.SnapshotEpochActivity)

ActivityLogConsumerFunc is the type of function that consumes Activity logs when loading a snapshot.

type ActivityLogProducerFunc added in v0.9.5

type ActivityLogProducerFunc func() (activityLogs epoch.SnapshotEpochActivity)

ActivityLogProducerFunc is the type of function that produces ActivityLog when taking a snapshot.

func NewActivityLogProducer added in v0.9.5

func NewActivityLogProducer(notarizationMgr *notarization.Manager, epochDiffIndex epoch.Index) ActivityLogProducerFunc

NewActivityLogProducer returns an ActivityLogProducerFunc that provides activity log from weightProvider and notarization manager.

type EpochDiffProducerFunc

type EpochDiffProducerFunc func() (epochDiffs *ledger.EpochDiff)

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

func NewEpochDiffsProducer

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

NewEpochDiffsProducer returns a OutputWithMetadataProducerFunc that provide OutputWithMetadatas from the ledger.

type EpochDiffsConsumerFunc

type EpochDiffsConsumerFunc func(epochDiffs *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 Manager added in v0.9.5

type Manager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Manager is the snapshot manager.

func NewManager added in v0.9.5

func NewManager(nmgr *notarization.Manager, depth int) (new *Manager)

NewManager creates and returns a new snapshot manager.

func (*Manager) AdvanceSolidEntryPoints added in v0.9.5

func (m *Manager) AdvanceSolidEntryPoints(ei epoch.Index)

AdvanceSolidEntryPoints remove seps of old epoch when confirmed epoch advanced.

func (*Manager) CreateSnapshot added in v0.9.5

func (m *Manager) CreateSnapshot(snapshotFileName string) (header *ledger.SnapshotHeader, err error)

CreateSnapshot creates a snapshot file from node with a given name.

func (*Manager) InsertSolidEntryPoint added in v0.9.5

func (m *Manager) InsertSolidEntryPoint(id tangleold.BlockID)

InsertSolidEntryPoint inserts a solid entry point to the seps map.

func (*Manager) LoadSolidEntryPoints added in v0.9.5

func (m *Manager) LoadSolidEntryPoints(seps *SolidEntryPoints)

LoadSolidEntryPoints add solid entry points to storage.

func (*Manager) RemoveSolidEntryPoint added in v0.9.5

func (m *Manager) RemoveSolidEntryPoint(b *tangleold.Block) (err error)

RemoveSolidEntryPoint removes a solid entry points from the map.

type Snapshot

type Snapshot struct {
	LedgerSnapshot *ledger.Snapshot
}

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

type SolidEntryPoints added in v0.9.5

type SolidEntryPoints struct {
	EI   epoch.Index         `serix:"0"`
	Seps []tangleold.BlockID `serix:"1,lengthPrefixType=uint32"`
}

SolidEntryPoints contains solid entry points of an epoch.

type SolidEntryPointsConsumerFunc added in v0.9.5

type SolidEntryPointsConsumerFunc func(seps *SolidEntryPoints)

SolidEntryPointsConsumerFunc is the type of function that consumes solid entry points when loading a snapshot.

type SolidEntryPointsProducerFunc added in v0.9.5

type SolidEntryPointsProducerFunc func() (seps *SolidEntryPoints)

SolidEntryPointsProducerFunc is the type of function that produces solid entry points when taking a snapshot.

func NewSolidEntryPointsProducer added in v0.9.5

func NewSolidEntryPointsProducer(fullEpochIndex, latestCommitableEpoch epoch.Index, smgr *Manager) SolidEntryPointsProducerFunc

NewSolidEntryPointsProducer returns a SolidEntryPointsProducerFunc that provide solid entry points from the snapshot manager.

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(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