storage

package
v0.37.2-2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

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) GetBlock

func (m *MapStorage) GetBlock(height int64) (*types.Block, error)

func (*MapStorage) GetCommit

func (m *MapStorage) GetCommit(height int64) (*types.Commit, error)

func (*MapStorage) GetResponses

func (m *MapStorage) GetResponses(height int64) (*protostate.ABCIResponses, error)

func (*MapStorage) GetState

func (m *MapStorage) GetState(height int64) (*cometstate.State, error)

func (*MapStorage) InsertBlock

func (m *MapStorage) InsertBlock(height int64, block *types.Block) error

func (*MapStorage) InsertCommit

func (m *MapStorage) InsertCommit(height int64, commit *types.Commit) error

func (*MapStorage) InsertResponses

func (m *MapStorage) InsertResponses(height int64, responses *protostate.ABCIResponses) error

func (*MapStorage) InsertState

func (m *MapStorage) InsertState(height int64, state *cometstate.State) error

type Storage

type Storage interface {
	// InsertBlock inserts a block at a given height.
	// If there is already a block at that height, it should be overwritten.
	InsertBlock(height int64, block *types.Block) error
	// GetBlock returns the block at a given height.
	GetBlock(height int64) (*types.Block, error)

	// InsertCommit inserts a commit at a given height.
	// If there is already a commit at that height, it should be overwritten.
	InsertCommit(height int64, commit *types.Commit) error
	// GetCommit returns the commit at a given height.
	GetCommit(height int64) (*types.Commit, error)

	// InsertState inserts a state at a given height. This is the state after
	// applying the block at that height.
	// If there is already a state at that height, it should be overwritten.
	InsertState(height int64, state *cometstate.State) 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)

	// InsertResponses inserts the ABCI responses from a given height.
	// If there are already responses at that height, they should be overwritten.
	InsertResponses(height int64, responses *protostate.ABCIResponses) error
	// GetResponses returns the ABCI responses from a given height.
	GetResponses(height int64) (*protostate.ABCIResponses, error)
}

Storage is an interface for storing blocks, commits and states by height. All methods are thread-safe.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL