Documentation
¶
Overview ¶
Package txdb provides storage for Chain Protocol blockchain data structures.
Index ¶
- func DecodeSnapshot(data []byte) (*state.Snapshot, error)
- func LoadBlock(db dbm.DB, height uint64) *legacy.Block
- type BlockStoreStateJSON
- type SnapshotHeightJSON
- type Store
- func (s *Store) FinalizeBlock(ctx context.Context, height uint64) error
- func (s *Store) GetBlock(height uint64) (*legacy.Block, error)
- func (s *Store) GetRawBlock(height uint64) ([]byte, error)
- func (s *Store) GetSnapshot(ctx context.Context, height uint64) ([]byte, error)
- func (s *Store) Height() uint64
- func (s *Store) LatestSnapshot(ctx context.Context) (*state.Snapshot, uint64, error)
- func (s *Store) SaveBlock(block *legacy.Block) error
- func (s *Store) SaveSnapshot(ctx context.Context, height uint64, snapshot *state.Snapshot) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeSnapshot ¶
DecodeSnapshot decodes a snapshot from the Chain Core's binary, protobuf representation of the snapshot.
Types ¶
type BlockStoreStateJSON ¶
type BlockStoreStateJSON struct {
Height uint64
}
func LoadBlockStoreStateJSON ¶
func LoadBlockStoreStateJSON(db dbm.DB) BlockStoreStateJSON
func (BlockStoreStateJSON) Save ¶
func (bsj BlockStoreStateJSON) Save(db dbm.DB)
type SnapshotHeightJSON ¶
type SnapshotHeightJSON struct {
Height uint64
}
func LoadSnapshotHeightJSON ¶
func LoadSnapshotHeightJSON(db dbm.DB) SnapshotHeightJSON
func (SnapshotHeightJSON) Save ¶
func (bsj SnapshotHeightJSON) Save(db dbm.DB)
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
A Store encapsulates storage for blockchain validation. It satisfies the interface protocol.Store, and provides additional methods for querying current data.
func NewStore ¶
NewStore creates and returns a new Store object.
For testing purposes, it is usually much faster and more convenient to use package bytom/protocol/memstore instead.
func (*Store) FinalizeBlock ¶
func (*Store) GetSnapshot ¶
GetSnapshot returns the state snapshot stored at the provided height, in Chain Core's binary protobuf representation. If no snapshot exists at the provided height, an error is returned.
func (*Store) LatestSnapshot ¶
LatestSnapshot returns the most recent state snapshot stored in the database and its corresponding block height.