OSDN Git Service

new repo
[bytom/vapor.git] / protocol / store.go
1 package protocol
2
3 import (
4         "github.com/vapor/database/storage"
5         "github.com/vapor/protocol/bc"
6         "github.com/vapor/protocol/bc/types"
7         "github.com/vapor/protocol/state"
8 )
9
10 // Store provides storage interface for blockchain data
11 type Store interface {
12         BlockExist(*bc.Hash) bool
13
14         GetBlock(*bc.Hash) (*types.Block, error)
15         GetStoreStatus() *BlockStoreState
16         GetTransactionStatus(*bc.Hash) (*bc.TransactionStatus, error)
17         GetTransactionsUtxo(*state.UtxoViewpoint, []*bc.Tx) error
18         GetUtxo(*bc.Hash) (*storage.UtxoEntry, error)
19
20         LoadBlockIndex(uint64) (*state.BlockIndex, error)
21         SaveBlock(*types.Block, *bc.TransactionStatus) error
22         SaveChainStatus(*state.BlockNode, *state.UtxoViewpoint) error
23
24         IsWithdrawSpent(hash *bc.Hash) bool
25         SetWithdrawSpent(hash *bc.Hash)
26 }
27
28 // BlockStoreState represents the core's db status
29 type BlockStoreState struct {
30         Height uint64
31         Hash   *bc.Hash
32 }