engine

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: Apache-2.0, BSD-2-Clause Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) {
	return &Events{
		Error:          event.New1[error](),
		BlockProcessed: event.New1[models.BlockID](),
		EvictionState:  eviction.NewEvents(),
		Filter:         filter.NewEvents(),
		Ledger:         ledger.NewEvents(),
		Mesh:           mesh.NewEvents(),
		Consensus:      consensus.NewEvents(),
		Clock:          clock.NewEvents(),
		Notarization:   notarization.NewEvents(),
		BlockRequester: eventticker.NewEvents[models.BlockID](),
	}
})

NewEvents contains the constructor of the Events object (it is generated by a generic factory).

Functions

func WithBootstrapThreshold

func WithBootstrapThreshold(threshold time.Duration) options.Option[Engine]

func WithEntryPointsDepth

func WithEntryPointsDepth(entryPointsDepth int) options.Option[Engine]

func WithSnapshotDepth

func WithSnapshotDepth(depth int) options.Option[Engine]

func WithTSCManagerOptions

func WithTSCManagerOptions(opts ...options.Option[tsc.Manager]) options.Option[Engine]

Types

type Engine

type Engine struct {
	Events          *Events
	Storage         *storage.Storage
	SybilProtection sybilprotection.SybilProtection
	ThroughputQuota throughputquota.ThroughputQuota
	Ledger          ledger.Ledger
	Filter          filter.Filter
	EvictionState   *eviction.State
	BlockRequester  *eventticker.EventTicker[models.BlockID]
	Notarization    notarization.Notarization
	Mesh            mesh.Mesh
	Consensus       consensus.Consensus
	TSCManager      *tsc.Manager
	Clock           clock.Clock

	Workers *workerpool.Group

	ProcessingMutex sync.Mutex

	module.Module
	// contains filtered or unexported fields
}

func (*Engine) Block

func (e *Engine) Block(id models.BlockID) (block *models.Block, exists bool)

func (*Engine) Export

func (e *Engine) Export(writer io.WriteSeeker, targetSlot slot.Index) (err error)

func (*Engine) FirstUnacceptedMarker

func (e *Engine) FirstUnacceptedMarker(sequenceID markers.SequenceID) markers.Index

func (*Engine) Import

func (e *Engine) Import(reader io.ReadSeeker) (err error)

func (*Engine) Initialize

func (e *Engine) Initialize(snapshot ...string) (err error)

func (*Engine) IsBootstrapped

func (e *Engine) IsBootstrapped() (isBootstrapped bool)

func (*Engine) IsSynced

func (e *Engine) IsSynced() (isBootstrapped bool)

func (*Engine) LastConfirmedSlot

func (e *Engine) LastConfirmedSlot() slot.Index

func (*Engine) Name

func (e *Engine) Name() string

func (*Engine) ProcessBlockFromPeer

func (e *Engine) ProcessBlockFromPeer(block *models.Block, source identity.ID)

func (*Engine) RemoveFromFilesystem

func (e *Engine) RemoveFromFilesystem() error

RemoveFromFilesystem removes the directory of the engine from the filesystem.

func (*Engine) Shutdown

func (e *Engine) Shutdown()

func (*Engine) SlotTimeProvider

func (e *Engine) SlotTimeProvider() *slot.TimeProvider

func (*Engine) WriteSnapshot

func (e *Engine) WriteSnapshot(filePath string, targetSlot ...slot.Index) (err error)

type Events

type Events struct {
	Error          *event.Event1[error]
	BlockProcessed *event.Event1[models.BlockID]

	EvictionState  *eviction.Events
	Filter         *filter.Events
	Ledger         *ledger.Events
	Mesh           *mesh.Events
	Consensus      *consensus.Events
	Clock          *clock.Events
	Notarization   *notarization.Events
	BlockRequester *eventticker.Events[models.BlockID]

	event.Group[Events, *Events]
}

type TestFramework

type TestFramework struct {
	Instance *Engine

	Mesh          *mesh.TestFramework
	Booker        *booker.TestFramework
	BlockDAG      *blockdag.TestFramework
	MemPool       *mempool.TestFramework
	VirtualVoting *booker.VirtualVotingTestFramework
	Acceptance    *blockgadget.TestFramework
	// contains filtered or unexported fields
}

func NewTestFramework

func NewTestFramework(test *testing.T, workers *workerpool.Group, engine *Engine) *TestFramework

func (*TestFramework) AssertRootBlocks

func (e *TestFramework) AssertRootBlocks(rootBlocks []*models.Block)

func (*TestFramework) AssertSlotState

func (e *TestFramework) AssertSlotState(index slot.Index)

func (*TestFramework) ExportBytes

func (e *TestFramework) ExportBytes(export func(io.WriteSeeker, slot.Index) error, targetIndex slot.Index) []byte

func (*TestFramework) SlotTimeProvider

func (e *TestFramework) SlotTimeProvider() *slot.TimeProvider

type WriteSeekerBuffer

type WriteSeekerBuffer struct {
	bytes.Buffer
	// contains filtered or unexported fields
}

func (*WriteSeekerBuffer) Seek

func (wsb *WriteSeekerBuffer) Seek(offset int64, whence int) (int64, error)

func (*WriteSeekerBuffer) Write

func (wsb *WriteSeekerBuffer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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