migration

package
v2.0.0-...-fda440d Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages the migration of the whole state from store/v1 to store/v2.

func NewManager

NewManager returns a new Manager.

NOTE: `sc` can be `nil` if don't want to migrate the commitment.

func (*Manager) Close

func (m *Manager) Close() error

Close closes the manager. It should be called after the migration is done. It will close the db and notify the snapshotsManager that the migration is done.

func (*Manager) GetMigratedVersion

func (m *Manager) GetMigratedVersion() uint64

GetMigratedVersion returns the migrated version. It is used to check the migrated version in the RootStore.

func (*Manager) GetStateCommitment

func (m *Manager) GetStateCommitment() *commitment.CommitStore

GetStateCommitment returns the state commitment.

func (*Manager) Migrate

func (m *Manager) Migrate(height uint64) error

Migrate migrates the whole state at the given height to the new store/v2.

func (*Manager) Start

func (m *Manager) Start(version uint64, chChangeset <-chan *VersionedChangeset, chDone <-chan struct{}) error

Start starts the whole migration process. It migrates the whole state at the given version to the new store/v2 (both SC and SS). It also catches up the Changesets which are committed while the migration is in progress. `chChangeset` is the channel to receive the committed Changesets from the RootStore. `chDone` is the channel to receive the done signal from the RootStore. NOTE: It should be called by the RootStore, running in the background.

func (*Manager) Sync

func (m *Manager) Sync() error

Sync catches up the Changesets which are committed while the migration is in progress. It should be called after the migration is done.

type MigrationStream

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

MigrationStream is a stream for migrating the whole IAVL state as a snapshot. It's used to sync the whole state from the store/v1 to store/v2. The main idea is to use the same snapshotter interface without writing to disk.

func NewMigrationStream

func NewMigrationStream(chBufferSize int) *MigrationStream

NewMigrationStream returns a new MigrationStream.

func (*MigrationStream) Close

func (ms *MigrationStream) Close() error

Close implements io.Closer interface.

func (*MigrationStream) CloseWithError

func (ms *MigrationStream) CloseWithError(err error)

CloseWithError implements snapshots.WriteCloser interface.

func (*MigrationStream) ReadMsg

func (ms *MigrationStream) ReadMsg(msg proto.Message) error

ReadMsg implements the protoio.Read interface.

NOTE: It we follow the pattern of snapshot.Restore, however, the migration is done in memory. It doesn't require any deserialization -- just passing the pointer to the <msg>.

func (*MigrationStream) WriteMsg

func (ms *MigrationStream) WriteMsg(msg proto.Message) error

WriteMsg implements protoio.Write interface.

type VersionedChangeset

type VersionedChangeset struct {
	Version   uint64
	Changeset *corestore.Changeset
}

VersionedChangeset is a pair of version and Changeset.

Jump to

Keyboard shortcuts

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