github.com/koko1123/flow-go-1@v0.29.6/state/protocol/events/gadgets.go (about)

     1  package events
     2  
     3  import "github.com/koko1123/flow-go-1/model/flow"
     4  
     5  // Heights enables subscribing to specific heights. The callback is invoked
     6  // when the given height is finalized.
     7  type Heights interface {
     8  
     9  	// OnHeight registers the callback for the given height.
    10  	OnHeight(height uint64, callback func())
    11  }
    12  
    13  // OnViewCallback is the type of callback triggered by view events.
    14  type OnViewCallback func(*flow.Header)
    15  
    16  // Views enables subscribing to specific views. The callback is invoked when the
    17  // first block of the given view is finalized.
    18  type Views interface {
    19  	// OnView registers the callback for the given view.
    20  	OnView(view uint64, callback OnViewCallback)
    21  }