sm_snapshots

package
v0.7.0-alpha.10 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProgressReporter

func NewProgressReporter(log *logger.Logger, header string, expected uint64) io.Writer

Types

type MockedSnapshotManager

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

func NewMockedSnapshotManager

func NewMockedSnapshotManager(
	t *testing.T,
	createPeriod uint32,
	origStore state.Store,
	nodeStore state.Store,
	snapshotCommitTime time.Duration,
	snapshotLoadTime time.Duration,
	timeProvider sm_gpa_utils.TimeProvider,
	log *logger.Logger,
) *MockedSnapshotManager

func (MockedSnapshotManager) BlockCommittedAsync

func (smrT MockedSnapshotManager) BlockCommittedAsync(snapshotInfo SnapshotInfo)

func (*MockedSnapshotManager) IsSnapshotReady

func (msmT *MockedSnapshotManager) IsSnapshotReady(snapshotInfo SnapshotInfo) bool

func (MockedSnapshotManager) LoadSnapshotAsync

func (smrT MockedSnapshotManager) LoadSnapshotAsync(snapshotInfo SnapshotInfo) <-chan error

func (*MockedSnapshotManager) SetAfterSnapshotCreated

func (msmT *MockedSnapshotManager) SetAfterSnapshotCreated(fun func(SnapshotInfo))

func (*MockedSnapshotManager) SnapshotExists

func (msmT *MockedSnapshotManager) SnapshotExists(stateIndex uint32, commitment *state.L1Commitment) bool

func (*MockedSnapshotManager) SnapshotReady

func (msmT *MockedSnapshotManager) SnapshotReady(snapshotInfo SnapshotInfo)

func (MockedSnapshotManager) UpdateAsync

func (smrT MockedSnapshotManager) UpdateAsync()

func (*MockedSnapshotManager) WaitNodeUpdateCount

func (msmT *MockedSnapshotManager) WaitNodeUpdateCount(count uint32, sleepTime time.Duration, maxSleepCount int) bool

func (*MockedSnapshotManager) WaitSnapshotCreateFinalisedCount

func (msmT *MockedSnapshotManager) WaitSnapshotCreateFinalisedCount(count uint32, sleepTime time.Duration, maxSleepCount int) bool

func (*MockedSnapshotManager) WaitSnapshotCreateRequestCount

func (msmT *MockedSnapshotManager) WaitSnapshotCreateRequestCount(count uint32, sleepTime time.Duration, maxSleepCount int) bool

func (*MockedSnapshotManager) WaitSnapshotCreatedCount

func (msmT *MockedSnapshotManager) WaitSnapshotCreatedCount(count uint32, sleepTime time.Duration, maxSleepCount int) bool

func (*MockedSnapshotManager) WaitSnapshotLoadRequestCount

func (msmT *MockedSnapshotManager) WaitSnapshotLoadRequestCount(count uint32, sleepTime time.Duration, maxSleepCount int) bool

func (*MockedSnapshotManager) WaitSnapshotLoadedCount

func (msmT *MockedSnapshotManager) WaitSnapshotLoadedCount(count uint32, sleepTime time.Duration, maxSleepCount int) bool

type SnapshotInfo

type SnapshotInfo interface {
	StateIndex() uint32
	Commitment() *state.L1Commitment
	TrieRoot() trie.Hash
	BlockHash() state.BlockHash
	String() string
	Equals(SnapshotInfo) bool
}

func NewSnapshotInfo

func NewSnapshotInfo(index uint32, commitment *state.L1Commitment) SnapshotInfo

type SnapshotManager

type SnapshotManager interface {
	UpdateAsync()
	BlockCommittedAsync(SnapshotInfo)
	SnapshotExists(uint32, *state.L1Commitment) bool
	LoadSnapshotAsync(SnapshotInfo) <-chan error
}

SnapshotManager is responsible for servicing snapshot related queries in appropriate manner. Some of the requests are synchronous, but most of them are asynchronous. They can be handled in snapshot manager's thread or in another thread created by snapshot manager. Snapshot manager keeps and updates on request a list of available snapshots. However, only the information that snapshot exists is stored and not the entire snapshot. To store/load the snapshot, snapshot manager depends on `snapshotter`. Snapshot manager is also responsible for deciding if snapshot has to be created.

func NewEmptySnapshotManager

func NewEmptySnapshotManager() SnapshotManager

func NewSnapshotManager

func NewSnapshotManager(
	ctx context.Context,
	shutdownCoordinator *shutdown.Coordinator,
	chainID isc.ChainID,
	createPeriod uint32,
	baseLocalPath string,
	baseNetworkPaths []string,
	store state.Store,
	log *logger.Logger,
) (SnapshotManager, error)

Jump to

Keyboard shortcuts

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