snapshot

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpentAddressesImportBatchSize       = 100000
	SolidEntryPointCheckThresholdPast   = 50
	SolidEntryPointCheckThresholdFuture = 50
)
View Source
const (
	// AdditionalPruningThreshold is needed, because the transactions in the getMilestoneApprovees call in getSolidEntryPoints
	// can reference older transactions as well
	AdditionalPruningThreshold = 50
)

Variables

View Source
var (
	SupportedLocalSnapshotFileVersions = []byte{4}

	ErrCritical                 = errors.New("critical error")
	ErrUnsupportedLSFileVersion = errors.New("unsupported local snapshot file version")
	ErrApproverTxNotFound       = errors.New("approver transaction not found")
)
View Source
var (
	PLUGIN = node.NewPlugin("Snapshot", node.Enabled, configure, run)

	ErrNoSnapshotSpecified             = errors.New("no snapshot file was specified in the config")
	ErrNoSnapshotDownloadURL           = fmt.Errorf("no download URL given for local snapshot under config option '%s", config.CfgLocalSnapshotsDownloadURLs)
	ErrSnapshotDownloadWasAborted      = errors.New("snapshot download was aborted")
	ErrSnapshotDownloadNoValidSource   = errors.New("no valid source found, snapshot download not possible")
	ErrSnapshotImportWasAborted        = errors.New("snapshot import was aborted")
	ErrSnapshotImportFailed            = errors.New("snapshot import failed")
	ErrSnapshotCreationWasAborted      = errors.New("operation was aborted")
	ErrSnapshotCreationFailed          = errors.New("creating snapshot failed")
	ErrTargetIndexTooNew               = errors.New("snapshot target is too new.")
	ErrTargetIndexTooOld               = errors.New("snapshot target is too old.")
	ErrNotEnoughHistory                = errors.New("not enough history.")
	ErrNoPruningNeeded                 = errors.New("no pruning needed.")
	ErrPruningAborted                  = errors.New("pruning was aborted.")
	ErrUnconfirmedTxInSubtangle        = errors.New("unconfirmed tx in subtangle")
	ErrInvalidBalance                  = errors.New("invalid balance! total does not match supply:")
	ErrWrongCoordinatorAddressDatabase = errors.New("configured coordinator address does not match database information")
)

Functions

func CreateLocalSnapshot

func CreateLocalSnapshot(targetIndex milestone.Index, filePath string, writeToDatabase bool, abortSignal <-chan struct{}) error

func LoadGlobalSnapshot

func LoadGlobalSnapshot(filePathLedger string, filePathsSpent []string, snapshotIndex milestone.Index) error

func LoadSnapshotFromFile

func LoadSnapshotFromFile(filePath string) error

func PruneDatabaseByDepth

func PruneDatabaseByDepth(depth milestone.Index) error

func PruneDatabaseByTargetIndex

func PruneDatabaseByTargetIndex(targetIndex milestone.Index) error

Types

type WriteCounter

type WriteCounter struct {
	Expected         uint64
	Total            uint64
	Last             uint64
	LastProgressTime time.Time
}

WriteCounter counts the number of bytes written to it. It implements to the io.Writer interface and we can pass this into io.TeeReader() which will report progress on each write cycle.

func (*WriteCounter) PrintProgress

func (wc *WriteCounter) PrintProgress()

func (*WriteCounter) Write

func (wc *WriteCounter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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