github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/bft/state/services.go (about)

     1  package state
     2  
     3  import (
     4  	"github.com/gnolang/gno/tm2/pkg/bft/types"
     5  )
     6  
     7  //------------------------------------------------------
     8  // blockchain services types
     9  // NOTE: Interfaces used by RPC must be thread safe!
    10  //------------------------------------------------------
    11  
    12  //------------------------------------------------------
    13  // blockstore
    14  
    15  // BlockStoreRPC is the block store interface used by the RPC.
    16  type BlockStoreRPC interface {
    17  	Height() int64
    18  
    19  	LoadBlockMeta(height int64) *types.BlockMeta
    20  	LoadBlock(height int64) *types.Block
    21  	LoadBlockPart(height int64, index int) *types.Part
    22  
    23  	LoadBlockCommit(height int64) *types.Commit
    24  	LoadSeenCommit(height int64) *types.Commit
    25  }
    26  
    27  // BlockStore defines the BlockStore interface used by the ConsensusState.
    28  type BlockStore interface {
    29  	BlockStoreRPC
    30  	SaveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit)
    31  }