github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/consensus/hotstuff/timeout_collectors.go (about)

     1  package hotstuff
     2  
     3  // TimeoutCollectors encapsulates the functionality to generate, store and prune `TimeoutCollector`
     4  // instances (one per view). Its main purpose is to provide a higher-level API to `TimeoutAggregator`
     5  // for managing and interacting with the view-specific `TimeoutCollector` instances.
     6  // Implementations are concurrency safe.
     7  type TimeoutCollectors interface {
     8  	// GetOrCreateCollector retrieves the TimeoutCollector for the specified
     9  	// view or creates one if none exists.  When creating a timeout collector,
    10  	// the view is used to query the consensus committee for the respective
    11  	// Epoch the view belongs to.
    12  	// It returns:
    13  	//  -  (collector, true, nil) if no collector can be found by the view, and a new collector was created.
    14  	//  -  (collector, false, nil) if the collector can be found by the view.
    15  	//  -  (nil, false, error) if running into any exception creating the timeout collector.
    16  	// Expected error returns during normal operations:
    17  	//  * mempool.BelowPrunedThresholdError if view is below the pruning threshold
    18  	//  * model.ErrViewForUnknownEpoch if view is not yet pruned but no epoch containing the given view is known
    19  	GetOrCreateCollector(view uint64) (collector TimeoutCollector, created bool, err error)
    20  
    21  	// PruneUpToView prunes the timeout collectors with views _below_ the given value, i.e.
    22  	// we only retain and process timeout collectors, whose views are equal or larger than `lowestRetainedView`.
    23  	// If `lowestRetainedView` is smaller than the previous value, the previous value is
    24  	// kept and the method call is a NoOp.
    25  	PruneUpToView(lowestRetainedView uint64)
    26  }