github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/storage/height.go (about)

     1  package storage
     2  
     3  // HeightIndex defines methods for indexing height.
     4  // This interface should normally be composed with some other resource we want to index by height.
     5  type HeightIndex interface {
     6  	// LatestHeight returns the latest indexed height.
     7  	LatestHeight() (uint64, error)
     8  	// FirstHeight at which we started to index. Returns the first indexed height found in the store.
     9  	FirstHeight() (uint64, error)
    10  	// SetLatestHeight updates the latest height.
    11  	// The provided height should either be one higher than the current height or the same to ensure idempotency.
    12  	// If the height is not within those bounds it will panic!
    13  	// An error might get returned if there are problems with persisting the height.
    14  	SetLatestHeight(height uint64) error
    15  }