importer

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KiB = 1024
	MiB = 1024 * KiB

	MaxTotalBatchSize  = 20 * MiB
	MaxBlocksBatchSize = 50000
	MaxBlockSize       = 2 * MiB
)

Variables

This section is empty.

Functions

func ApplyFromFile

func ApplyFromFile(
	ctx context.Context,
	params ImportParams,
	state State,
	nBlocks, startHeight uint64,
) error

ApplyFromFile reads blocks from blockchainPath, applying them from height startHeight and until nBlocks+1. Setting optimize to true speeds up the import, but it is only safe when importing blockchain from scratch when no rollbacks are possible at all.

func CheckBalances

func CheckBalances(st State, balancesPath string) error

Types

type BlocksImporter added in v0.11.0

type BlocksImporter struct {
	// contains filtered or unexported fields
}

func NewBlocksImporter added in v0.11.0

func NewBlocksImporter(scheme proto.Scheme, st State, blocksPath string) (*BlocksImporter, error)

func (*BlocksImporter) Close added in v0.11.0

func (imp *BlocksImporter) Close() error

func (*BlocksImporter) Import added in v0.11.0

func (imp *BlocksImporter) Import(ctx context.Context, number uint64) error

func (*BlocksImporter) SkipToHeight added in v0.11.0

func (imp *BlocksImporter) SkipToHeight(ctx context.Context, height proto.Height) error

type ImportParams added in v0.11.0

type ImportParams struct {
	Schema                        proto.Scheme
	BlockchainPath, SnapshotsPath string
	LightNodeMode                 bool
}

type Importer added in v0.11.0

type Importer interface {
	SkipToHeight(context.Context, uint64) error
	Import(context.Context, uint64) error
	Close() error
}

type SnapshotsImporter added in v0.11.0

type SnapshotsImporter struct {
	// contains filtered or unexported fields
}

func NewSnapshotsImporter added in v0.11.0

func NewSnapshotsImporter(scheme proto.Scheme, st State, blocksPath, snapshotsPath string) (*SnapshotsImporter, error)

func (*SnapshotsImporter) Close added in v0.11.0

func (imp *SnapshotsImporter) Close() error

func (*SnapshotsImporter) Import added in v0.11.0

func (imp *SnapshotsImporter) Import(ctx context.Context, number uint64) error

func (*SnapshotsImporter) SkipToHeight added in v0.11.0

func (imp *SnapshotsImporter) SkipToHeight(ctx context.Context, height proto.Height) error

type State

type State interface {
	AddBlocks(blocks [][]byte) error
	AddBlocksWithSnapshots(blocks [][]byte, snapshots []*proto.BlockSnapshot) error
	WavesAddressesNumber() (uint64, error)
	WavesBalance(account proto.Recipient) (uint64, error)
	AssetBalance(account proto.Recipient, assetID proto.AssetID) (uint64, error)
	ShouldPersistAddressTransactions() (bool, error)
	PersistAddressTransactions() error
}

Jump to

Keyboard shortcuts

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