Documentation ¶
Index ¶
- type Manager
- func (m *Manager) Close() error
- func (m *Manager) GetMigratedVersion() uint64
- func (m *Manager) GetStateCommitment() *commitment.CommitStore
- func (m *Manager) Migrate(height uint64) error
- func (m *Manager) Start(version uint64, chChangeset <-chan *VersionedChangeset, chDone <-chan struct{}) error
- func (m *Manager) Sync() error
- type MigrationStream
- type VersionedChangeset
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 ¶
func NewManager(db corestore.KVStoreWithBatch, sm *snapshots.Manager, sc *commitment.CommitStore, logger log.Logger) *Manager
NewManager returns a new Manager.
NOTE: `sc` can be `nil` if don't want to migrate the commitment.
func (*Manager) Close ¶
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 ¶
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) 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.
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>.
type VersionedChangeset ¶
VersionedChangeset is a pair of version and Changeset.