migrations

package
v0.0.0-...-92d349b Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMigrationNonUniqueName   = fmt.Errorf("please provide unique migration name")
	ErrMigrationCommitNotCalled = fmt.Errorf("migration before-commit function was not called")
	ErrMigrationETLFilesDeleted = fmt.Errorf("db migration progress was interrupted after extraction step and ETL files was deleted, please contact development team for help or re-sync from scratch")
)
View Source
var ErrTxsBeginEndNoMigration = fmt.Errorf("in this Erigon version DB format was changed: added additional first/last system-txs to blocks. There is no DB migration for this change. Please re-sync or switch to earlier version")

Functions

func AppliedMigrations

func AppliedMigrations(tx kv.Tx, withPayload bool) (map[string][]byte, error)

func MarshalMigrationPayload

func MarshalMigrationPayload(db kv.Getter) ([]byte, error)

func UnmarshalMigrationPayload

func UnmarshalMigrationPayload(data []byte) (map[string][]byte, error)

Types

type Callback

type Callback func(tx kv.RwTx, progress []byte, isDone bool) error

type Migration

type Migration struct {
	Name string
	Up   func(db kv.RwDB, dirs datadir.Dirs, progress []byte, BeforeCommit Callback) error
}

type Migrator

type Migrator struct {
	Migrations []Migration
}

func NewMigrator

func NewMigrator(label kv.Label) *Migrator

func (*Migrator) Apply

func (m *Migrator) Apply(db kv.RwDB, dataDir string) error

func (*Migrator) HasPendingMigrations

func (m *Migrator) HasPendingMigrations(db kv.RwDB) (bool, error)

func (*Migrator) PendingMigrations

func (m *Migrator) PendingMigrations(tx kv.Tx) ([]Migration, error)

func (*Migrator) VerifyVersion

func (m *Migrator) VerifyVersion(db kv.RwDB) error

Jump to

Keyboard shortcuts

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