Documentation ¶
Index ¶
- func CreateSnapshot(filePath string, headerProd HeaderProducerFunc, ...) (*ledger.SnapshotHeader, error)
- func LoadSnapshot(filePath string, headerConsumer HeaderConsumerFunc, ...) (err error)
- type ActivityLogConsumerFunc
- type ActivityLogProducerFunc
- type EpochDiffProducerFunc
- type EpochDiffsConsumerFunc
- type HeaderConsumerFunc
- type HeaderProducerFunc
- type Manager
- func (m *Manager) AdvanceSolidEntryPoints(ei epoch.Index)
- func (m *Manager) CreateSnapshot(snapshotFileName string) (header *ledger.SnapshotHeader, err error)
- func (m *Manager) InsertSolidEntryPoint(id tangleold.BlockID)
- func (m *Manager) LoadSolidEntryPoints(seps *SolidEntryPoints)
- func (m *Manager) RemoveSolidEntryPoint(b *tangleold.Block) (err error)
- type Snapshot
- type SolidEntryPoints
- type SolidEntryPointsConsumerFunc
- type SolidEntryPointsProducerFunc
- type UTXOStatesConsumerFunc
- type UTXOStatesProducerFunc
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 ¶
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 ¶
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
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
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
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.
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.