smGPAUtils

package
v0.5.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockCache

type BlockCache interface {
	AddBlock(state.Block)
	GetBlock(*state.L1Commitment) state.Block
	CleanOlderThan(time.Time)
}

func NewBlockCache

func NewBlockCache(tp TimeProvider, wal BlockWAL, log *logger.Logger) (BlockCache, error)

type BlockCacheTimers

type BlockCacheTimers struct {
	// How long should the block stay in cache before being deleted
	BlocksInCacheDuration time.Duration
	// How often should the block cache be cleened
	BlockCleaningPeriod time.Duration
}

func NewBlockCacheTimers

func NewBlockCacheTimers() BlockCacheTimers

type BlockFactory

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

func NewBlockFactory

func NewBlockFactory(t require.TestingT) *BlockFactory

func (*BlockFactory) GetAliasOutput

func (bfT *BlockFactory) GetAliasOutput(commitment *state.L1Commitment) *isc.AliasOutputWithID

func (*BlockFactory) GetBlocks

func (bfT *BlockFactory) GetBlocks(
	count,
	branchingFactor int,
) []state.Block

func (*BlockFactory) GetBlocksFrom

func (bfT *BlockFactory) GetBlocksFrom(
	count,
	branchingFactor int,
	commitment *state.L1Commitment,
	incrementFactorOpt ...uint64,
) []state.Block

func (*BlockFactory) GetChainID

func (bfT *BlockFactory) GetChainID() isc.ChainID

func (*BlockFactory) GetNextBlock

func (bfT *BlockFactory) GetNextBlock(
	commitment *state.L1Commitment,
	incrementOpt ...uint64,
) state.Block

func (*BlockFactory) GetOriginOutput

func (bfT *BlockFactory) GetOriginOutput() *isc.AliasOutputWithID

func (*BlockFactory) GetState

func (bfT *BlockFactory) GetState(commitment *state.L1Commitment) state.State

func (*BlockFactory) GetStateDraft

func (bfT *BlockFactory) GetStateDraft(block state.Block) state.StateDraft

type BlockKey

type BlockKey state.BlockHash

Type for block identifier to be used when putting blocks in maps.

func NewBlockKey

func NewBlockKey(commitment *state.L1Commitment) BlockKey

func (BlockKey) AsBlockHash

func (bkT BlockKey) AsBlockHash() state.BlockHash

func (BlockKey) Equals

func (bkT BlockKey) Equals(other BlockKey) bool

func (BlockKey) String

func (bkT BlockKey) String() string

type BlockWAL

type BlockWAL interface {
	Write(state.Block) error
	Contains(state.BlockHash) bool
	Read(state.BlockHash) (state.Block, error)
}

func NewBlockWAL

func NewBlockWAL(log *logger.Logger, baseDir string, chainID isc.ChainID, metrics *BlockWALMetrics) (BlockWAL, error)

func NewEmptyBlockWAL

func NewEmptyBlockWAL() BlockWAL

func NewMockedBlockWAL

func NewMockedBlockWAL() BlockWAL

type BlockWALMetrics

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

func NewBlockWALMetrics

func NewBlockWALMetrics() *BlockWALMetrics

func (*BlockWALMetrics) Register

func (m *BlockWALMetrics) Register(registry *prometheus.Registry)

type TestBlockWAL

type TestBlockWAL interface {
	BlockWAL
	Delete(state.BlockHash) bool
}

May be used only for tests; deleting in production should not be available.

func NewEmptyTestBlockWAL

func NewEmptyTestBlockWAL() TestBlockWAL

func NewMockedTestBlockWAL

func NewMockedTestBlockWAL() TestBlockWAL

type TimeProvider

type TimeProvider interface {
	SetNow(time.Time)
	GetNow() time.Time
	After(time.Duration) <-chan time.Time
}

func NewArtifficialTimeProvider

func NewArtifficialTimeProvider(nowOpt ...time.Time) TimeProvider

func NewDefaultTimeProvider

func NewDefaultTimeProvider() TimeProvider

Jump to

Keyboard shortcuts

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