github.com/soomindae/tendermint@v0.0.5-0.20210528140126-84a0c70c8162/light/store/store.go (about)

     1  package store
     2  
     3  import "github.com/soomindae/tendermint/types"
     4  
     5  // Store is anything that can persistently store headers.
     6  type Store interface {
     7  	// SaveSignedHeaderAndValidatorSet saves a SignedHeader (h: sh.Height) and a
     8  	// ValidatorSet (h: sh.Height).
     9  	//
    10  	// height must be > 0.
    11  	SaveLightBlock(lb *types.LightBlock) error
    12  
    13  	// DeleteSignedHeaderAndValidatorSet deletes SignedHeader (h: height) and
    14  	// ValidatorSet (h: height).
    15  	//
    16  	// height must be > 0.
    17  	DeleteLightBlock(height int64) error
    18  
    19  	// LightBlock returns the LightBlock that corresponds to the given
    20  	// height.
    21  	//
    22  	// height must be > 0.
    23  	//
    24  	// If LightBlock is not found, ErrLightBlockNotFound is returned.
    25  	LightBlock(height int64) (*types.LightBlock, error)
    26  
    27  	// LastLightBlockHeight returns the last (newest) LightBlock height.
    28  	//
    29  	// If the store is empty, -1 and nil error are returned.
    30  	LastLightBlockHeight() (int64, error)
    31  
    32  	// FirstLightBlockHeight returns the first (oldest) LightBlock height.
    33  	//
    34  	// If the store is empty, -1 and nil error are returned.
    35  	FirstLightBlockHeight() (int64, error)
    36  
    37  	// LightBlockBefore returns the LightBlock before a certain height.
    38  	//
    39  	// height must be > 0 && <= LastLightBlockHeight.
    40  	LightBlockBefore(height int64) (*types.LightBlock, error)
    41  
    42  	// Prune removes headers & the associated validator sets when Store reaches a
    43  	// defined size (number of header & validator set pairs).
    44  	Prune(size uint16) error
    45  
    46  	// Size returns a number of currently existing header & validator set pairs.
    47  	Size() uint16
    48  }