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

     1  package storage
     2  
     3  import (
     4  	"github.com/onflow/flow-go/model/flow"
     5  )
     6  
     7  // RegisterIndex defines methods for the register index.
     8  type RegisterIndex interface {
     9  	// Get register by the register ID at a given block height.
    10  	//
    11  	// If the register at the given height was not indexed, returns the highest
    12  	// height the register was indexed at.
    13  	// Expected errors:
    14  	// - storage.ErrHeightNotIndexed if the given height was not indexed yet or lower than the first indexed height.
    15  	// - storage.ErrNotFound if the given height is indexed, but the register does not exist.
    16  	Get(ID flow.RegisterID, height uint64) (flow.RegisterValue, error)
    17  
    18  	// LatestHeight returns the latest indexed height.
    19  	LatestHeight() uint64
    20  
    21  	// FirstHeight at which we started to index. Returns the first indexed height found in the store.
    22  	FirstHeight() uint64
    23  
    24  	// Store batch of register entries at the provided block height.
    25  	//
    26  	// The provided height must either be one higher than the current height or the same to ensure idempotency,
    27  	// otherwise and error is returned. If the height is not within those bounds there is either a bug
    28  	// or state corruption.
    29  	//
    30  	// No errors are expected during normal operation.
    31  	Store(entries flow.RegisterEntries, height uint64) error
    32  }