OSDN Git Service

Hulk did something
[bytom/vapor.git] / protocol / store.go
diff --git a/protocol/store.go b/protocol/store.go
new file mode 100644 (file)
index 0000000..c1e2d70
--- /dev/null
@@ -0,0 +1,29 @@
+package protocol
+
+import (
+       "github.com/vapor/database/storage"
+       "github.com/vapor/protocol/bc"
+       "github.com/vapor/protocol/bc/types"
+       "github.com/vapor/protocol/state"
+)
+
+// Store provides storage interface for blockchain data
+type Store interface {
+       BlockExist(*bc.Hash) bool
+
+       GetBlock(*bc.Hash) (*types.Block, error)
+       GetStoreStatus() *BlockStoreState
+       GetTransactionStatus(*bc.Hash) (*bc.TransactionStatus, error)
+       GetTransactionsUtxo(*state.UtxoViewpoint, []*bc.Tx) error
+       GetUtxo(*bc.Hash) (*storage.UtxoEntry, error)
+
+       LoadBlockIndex(uint64) (*state.BlockIndex, error)
+       SaveBlock(*types.Block, *bc.TransactionStatus) error
+       SaveChainStatus(*state.BlockNode, *state.UtxoViewpoint) error
+}
+
+// BlockStoreState represents the core's db status
+type BlockStoreState struct {
+       Height uint64
+       Hash   *bc.Hash
+}