github.com/pokt-network/tendermint@v0.32.11-0.20230426215212-59310158d3e9/lite2/store/store.go (about) 1 package store 2 3 import "github.com/tendermint/tendermint/types" 4 5 // Store is anything that can persistenly 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 SaveSignedHeaderAndValidatorSet(sh *types.SignedHeader, valSet *types.ValidatorSet) error 12 13 // DeleteSignedHeaderAndValidatorSet deletes SignedHeader (h: height) and 14 // ValidatorSet (h: height). 15 // 16 // height must be > 0. 17 DeleteSignedHeaderAndValidatorSet(height int64) error 18 19 // SignedHeader returns the SignedHeader that corresponds to the given 20 // height. 21 // 22 // height must be > 0. 23 // 24 // If SignedHeader is not found, ErrSignedHeaderNotFound is returned. 25 SignedHeader(height int64) (*types.SignedHeader, error) 26 27 // ValidatorSet returns the ValidatorSet that corresponds to height. 28 // 29 // height must be > 0. 30 // 31 // If ValidatorSet is not found, ErrValidatorSetNotFound is returned. 32 ValidatorSet(height int64) (*types.ValidatorSet, error) 33 34 // LastSignedHeaderHeight returns the last (newest) SignedHeader height. 35 // 36 // If the store is empty, -1 and nil error are returned. 37 LastSignedHeaderHeight() (int64, error) 38 39 // FirstSignedHeaderHeight returns the first (oldest) SignedHeader height. 40 // 41 // If the store is empty, -1 and nil error are returned. 42 FirstSignedHeaderHeight() (int64, error) 43 44 // SignedHeaderBefore returns the SignedHeader before a certain height. 45 // 46 // height must be > 0 && <= LastSignedHeaderHeight. 47 SignedHeaderBefore(height int64) (*types.SignedHeader, error) 48 49 // Prune removes headers & the associated validator sets when Store reaches a 50 // defined size (number of header & validator set pairs). 51 Prune(size uint16) error 52 53 // Size returns a number of currently existing header & validator set pairs. 54 Size() uint16 55 }