deprecated

package
v0.16.8 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 31 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package deprecated contains the legacy migration system.

Deprecated: This package is deprecated and will be removed in a future version. Use the migration package instead for new migrations.

Index

Constants

This section is empty.

Variables

View Source
var ErrCallWithNewTransaction = errors.New("call with new transaction")

Functions

func MigrateIfNeeded

func MigrateIfNeeded(
	ctx context.Context,
	targetDB db.KeyValueStore,
	network *networks.Network,
	logger log.StructuredLogger,
) error

func SchemaMetadata

func SchemaMetadata(log log.StructuredLogger, targetDB db.KeyValueStore) (schemaMetadata, error)

SchemaMetadata retrieves metadata about a database schema from the given database.

Types

type BucketMigrator

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

func NewBucketMigrator

func NewBucketMigrator(target db.Bucket, do BucketMigratorDoFunc) *BucketMigrator

func NewBucketMover

func NewBucketMover(source, destination db.Bucket) *BucketMigrator

func (*BucketMigrator) Before

func (m *BucketMigrator) Before(_ []byte) error

func (*BucketMigrator) Migrate

func (m *BucketMigrator) Migrate(
	ctx context.Context,
	database db.KeyValueStore,
	network *networks.Network,
	logger log.StructuredLogger,
) ([]byte, error)

func (*BucketMigrator) WithBatchSize

func (m *BucketMigrator) WithBatchSize(batchSize uint) *BucketMigrator

func (*BucketMigrator) WithBefore

func (m *BucketMigrator) WithBefore(before func()) *BucketMigrator

func (*BucketMigrator) WithKeyFilter

func (m *BucketMigrator) WithKeyFilter(keyFilter BucketMigratorKeyFilter) *BucketMigrator

type BucketMigratorDoFunc

type BucketMigratorDoFunc func(t db.KeyValueWriter, b1, b2 []byte, n *networks.Network) error

type BucketMigratorKeyFilter

type BucketMigratorKeyFilter func([]byte) (bool, error)

type HTTPConfig

type HTTPConfig struct {
	Enabled bool
	Host    string
	Port    uint16
}

type Migration

type Migration interface {
	Before(intermediateState []byte) error
	// Migration should return intermediate state whenever it requests new txn or
	// detects cancelled ctx.
	Migrate(
		context.Context,
		db.KeyValueStore,
		*networks.Network,
		log.StructuredLogger,
	) ([]byte, error)
}

type MigrationFunc

type MigrationFunc func(db.IndexedBatch, *networks.Network) error

func (MigrationFunc) Before

func (f MigrationFunc) Before(_ []byte) error

Before is a no-op.

func (MigrationFunc) Migrate

func (f MigrationFunc) Migrate(
	_ context.Context, database db.KeyValueStore, network *networks.Network, _ log.StructuredLogger,
) ([]byte, error)

Migrate returns f(txn).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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