sm_snapshots

package
v0.7.0-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 29 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 SliceStruct

type SliceStruct[E any] interface {
	Add(E)
	Get(int) E
	Set(int, E)
	Length() int
	ForEach(func(int, E) bool) bool
	Clone() SliceStruct[E]              // Returns a new SliceStruct with exactly the same elements
	CloneDeep(func(E) E) SliceStruct[E] // Returns a new SliceStruct with every element of the old SliceStruct cloned using provided function
	ContainsBy(func(E) bool) bool
	Find(func(E) bool) (E, bool)
}

Putting slice into a map is not acceptable as if you want to append to slice, you'll have to re-include the appended slice into the map.

func NewSliceStruct

func NewSliceStruct[E any](elems ...E) SliceStruct[E]

func NewSliceStructLength

func NewSliceStructLength[E any](length int) SliceStruct[E]

func NewSliceStructLengthCapacity

func NewSliceStructLengthCapacity[E any](length, capacity int) SliceStruct[E]

type SnapshotInfo

type SnapshotInfo interface {
	GetStateIndex() uint32
	GetCommitment() *state.L1Commitment
	GetTrieRoot() trie.Hash
	GetBlockHash() 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
}

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)

type SnapshotManagerTest

type SnapshotManagerTest interface {
	SnapshotManager
	SnapshotReady(SnapshotInfo)
	IsSnapshotReady(SnapshotInfo) bool
	SetAfterSnapshotCreated(func(SnapshotInfo))
}

func NewEmptySnapshotManager

func NewEmptySnapshotManager() SnapshotManagerTest

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,
) SnapshotManagerTest

Jump to

Keyboard shortcuts

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