matching

package
v0.14.7 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: AGPL-3.0 Imports: 29 Imported by: 3

Documentation

Index

Constants

View Source
const DefaultEmergencySealingActive = false

DefaultEmergencySealingActive is a flag which indicates when emergency sealing is active, this is a temporary measure to make fire fighting easier while seal & verification is under development.

View Source
const DefaultEmergencySealingThreshold = 400

DefaultEmergencySealingThreshold is the default number of blocks which indicates that ER should be sealed using emergency sealing.

View Source
const DefaultRequiredApprovalsForSealConstruction = 0

DefaultRequiredApprovalsForSealConstruction is the default number of approvals required to construct a candidate seal for subsequent inclusion in block.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	notifications.NoopConsumer
	// contains filtered or unexported fields
}

Engine is the Matching engine, which builds seals by matching receipts (aka ExecutionReceipt, from execution nodes) and approvals (aka ResultApproval, from verification nodes), and saves the seals into seals mempool for adding into a new block.

func New

func New(
	log zerolog.Logger,
	engineMetrics module.EngineMetrics,
	tracer module.Tracer,
	mempool module.MempoolMetrics,
	conMetrics module.ConsensusMetrics,
	net module.Network,
	state protocol.State,
	me module.Local,
	receiptRequester module.Requester,
	receiptsDB storage.ExecutionReceipts,
	headersDB storage.Headers,
	indexDB storage.Index,
	payloadsDB storage.Payloads,
	incorporatedResults mempool.IncorporatedResults,
	receipts mempool.ExecutionTree,
	approvals mempool.Approvals,
	seals mempool.IncorporatedResultSeals,
	pendingReceipts mempool.PendingReceipts,
	assigner module.ChunkAssigner,
	validator module.ReceiptValidator,
	requiredApprovalsForSealConstruction uint,
	emergencySealingActive bool,
) (*Engine, error)

func (*Engine) Done

func (e *Engine) Done() <-chan struct{}

Done returns a done channel that is closed once the engine has fully stopped. For the propagation engine, it closes the channel when all submit goroutines have ended.

func (*Engine) HandleReceipt

func (e *Engine) HandleReceipt(originID flow.Identifier, receipt flow.Entity)

HandleReceipt pipes explicitly requested receipts to the process function. Receipts can come from this function or the receipt provider setup in the engine constructor.

func (*Engine) OnBlockIncorporated added in v0.14.3

func (e *Engine) OnBlockIncorporated(block *model.Block)

OnBlockIncorporated implements the callback, which HotStuff executes when a block is incorporated

func (*Engine) Process

func (e *Engine) Process(originID flow.Identifier, event interface{}) error

Process processes the given event from the node with the given origin ID in a blocking manner. It returns the potential processing error when done.

func (*Engine) ProcessLocal

func (e *Engine) ProcessLocal(event interface{}) error

ProcessLocal processes an event originating on the local node.

func (*Engine) Ready

func (e *Engine) Ready() <-chan struct{}

Ready returns a ready channel that is closed once the engine has fully started. For the propagation engine, we consider the engine up and running upon initialization.

func (*Engine) Submit

func (e *Engine) Submit(originID flow.Identifier, event interface{})

Submit submits the given event from the node with the given origin ID for processing in a non-blocking manner. It returns instantly and logs a potential processing error internally when done.

func (*Engine) SubmitLocal

func (e *Engine) SubmitLocal(event interface{})

SubmitLocal submits an event originating on the local node.

type RequestTracker added in v0.14.0

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

RequestTracker is an index of RequestTrackerItems indexed by execution result ID and chunk index. It is not concurrency-safe.

func NewRequestTracker added in v0.14.0

func NewRequestTracker(blackoutPeriodMin, blackoutPeriodMax int) *RequestTracker

NewRequestTracker instantiates a new RequestTracker with blackout periods between min and max seconds.

func (*RequestTracker) Get added in v0.14.0

func (rt *RequestTracker) Get(resultID flow.Identifier, chunkIndex uint64) *RequestTrackerItem

Get returns the tracker item for a specific chunk, and creates a new one if it doesn't exist.

func (*RequestTracker) GetAll added in v0.14.0

func (rt *RequestTracker) GetAll() map[flow.Identifier]map[uint64]*RequestTrackerItem

GetAll returns a map of all the items in the tracker indexed by execution result ID and chunk index.

func (*RequestTracker) Remove added in v0.14.0

func (rt *RequestTracker) Remove(resultID flow.Identifier)

Remove removes all entries pertaining to an execution result

func (*RequestTracker) Set added in v0.14.0

func (rt *RequestTracker) Set(resultID flow.Identifier, chunkIndex uint64, item *RequestTrackerItem)

Set inserts or updates the tracker item for a specific chunk.

type RequestTrackerItem added in v0.14.0

type RequestTrackerItem struct {
	Requests    uint
	NextTimeout time.Time
	// contains filtered or unexported fields
}

RequestTrackerItem is an object that keeps track of how many times a request has been made, as well as the time until a new request can be made. It is not concurrency-safe.

func NewRequestTrackerItem added in v0.14.0

func NewRequestTrackerItem(blackoutPeriodMin, blackoutPeriodMax int) *RequestTrackerItem

NewRequestTrackerItem instantiates a new RequestTrackerItem where the NextTimeout is evaluated to the current time plus a random blackout period contained between min and max.

func (*RequestTrackerItem) IsBlackout added in v0.14.0

func (i *RequestTrackerItem) IsBlackout() bool

func (*RequestTrackerItem) Update added in v0.14.0

func (i *RequestTrackerItem) Update()

Update increments the number of requests and recomputes the NextTimeout.

Jump to

Keyboard shortcuts

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