Documentation ¶
Index ¶
- type MapStorage
- func (m *MapStorage) GetBlock(height int64) (*types.Block, error)
- func (m *MapStorage) GetCommit(height int64) (*types.Commit, error)
- func (m *MapStorage) GetResponses(height int64) (*abcitypes.ResponseFinalizeBlock, error)
- func (m *MapStorage) GetState(height int64) (*cometstate.State, error)
- func (m *MapStorage) LockBeforeStateUpdate()
- func (m *MapStorage) UnlockAfterStateUpdate()
- func (m *MapStorage) UpdateStores(height int64, block *types.Block, commit *types.Commit, ...) error
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MapStorage ¶
type MapStorage struct {
// contains filtered or unexported fields
}
MapStorage is a simple in-memory implementation of Storage.
func (*MapStorage) GetResponses ¶
func (m *MapStorage) GetResponses(height int64) (*abcitypes.ResponseFinalizeBlock, error)
func (*MapStorage) GetState ¶
func (m *MapStorage) GetState(height int64) (*cometstate.State, error)
func (*MapStorage) LockBeforeStateUpdate ¶
func (m *MapStorage) LockBeforeStateUpdate()
func (*MapStorage) UnlockAfterStateUpdate ¶
func (m *MapStorage) UnlockAfterStateUpdate()
func (*MapStorage) UpdateStores ¶
func (m *MapStorage) UpdateStores(height int64, block *types.Block, commit *types.Commit, state *cometstate.State, responses *abcitypes.ResponseFinalizeBlock) error
type Storage ¶
type Storage interface { // GetBlock returns the block at a given height. GetBlock(height int64) (*types.Block, error) // GetCommit returns the commit at a given height. GetCommit(height int64) (*types.Commit, error) // GetState returns the state at a given height. This is the state after // applying the block at that height. GetState(height int64) (*cometstate.State, error) // GetResponses returns the ABCI responses from a given height. GetResponses(height int64) (*abcitypes.ResponseFinalizeBlock, error) // LockBeforeStateUpdate locks the storage for state update. LockBeforeStateUpdate() // UnlockAfterStateUpdate unlocks the storage for state update. UnlockAfterStateUpdate() // UpdateStores updates the storage with the given block, commit, state and responses. // It is assumed that the block, commit, state and responses are all from the same height. // If they are not, the storage will be in an inconsistent state. // If the storage is already updated with the given height, the storage will overwrite the existing data. // This method is *not* thread-safe. // Before calling this, the caller should call LockForStateUpdate(). // After calling this, the caller should call UnlockForStateUpdate(). UpdateStores( height int64, block *types.Block, commit *types.Commit, state *cometstate.State, responses *abcitypes.ResponseFinalizeBlock, ) error }
Storage is an interface for storing blocks, commits and states by height. All methods are thread-safe.
Click to show internal directories.
Click to hide internal directories.