github.com/koko1123/flow-go-1@v0.29.6/engine/consensus/sealing_tracker.go (about) 1 package consensus 2 3 import "github.com/koko1123/flow-go-1/model/flow" 4 5 // SealingTracker is an auxiliary component for tracking progress of the sealing 6 // logic (specifically sealing.Core). It has access to the storage, to collect data 7 // that is not be available directly from sealing.Core. The SealingTracker is immutable 8 // and therefore intrinsically thread safe. 9 // 10 // The SealingTracker essentially acts as a factory for individual SealingObservations, 11 // which capture information about the progress of a _single_ go routine. Consequently, 12 // SealingObservations don't need to be concurrency safe, as they are supposed to 13 // be thread-local structure. 14 type SealingTracker interface { 15 16 // NewSealingObservation constructs a SealingObservation, which capture information 17 // about the progress of a _single_ go routine. Consequently, SealingObservations 18 // don't need to be concurrency safe, as they are supposed to be thread-local structure. 19 NewSealingObservation(finalizedBlock *flow.Header, seal *flow.Seal, sealedBlock *flow.Header) SealingObservation 20 } 21 22 // SealingObservation captures information about the progress of a _single_ go routine. 23 // Consequently, it is _not concurrency safe_, as SealingObservation is intended to be 24 // a thread-local structure. 25 // SealingObservation is supposed to track the status of various (unsealed) incorporated 26 // results, which sealing.Core processes (driven by that single goroutine). 27 type SealingObservation interface { 28 29 // QualifiesForEmergencySealing captures whether sealing.Core has 30 // determined that the incorporated result qualifies for emergency sealing. 31 QualifiesForEmergencySealing(ir *flow.IncorporatedResult, emergencySealable bool) 32 33 // ApprovalsMissing captures whether sealing.Core has determined that 34 // some approvals are still missing for the incorporated result. Calling this 35 // method with empty `chunksWithMissingApprovals` indicates that all chunks 36 // have sufficient approvals. 37 ApprovalsMissing(ir *flow.IncorporatedResult, chunksWithMissingApprovals map[uint64]flow.IdentifierList) 38 39 // ApprovalsRequested captures the number of approvals that the business 40 // logic has re-requested for the incorporated result. 41 ApprovalsRequested(ir *flow.IncorporatedResult, requestCount uint) 42 43 // Complete is supposed to be called when a single execution of the sealing logic 44 // has been completed. It compiles the information about the incorporated results. 45 Complete() 46 }