-
Notifications
You must be signed in to change notification settings - Fork 127
/
store.go
54 lines (46 loc) · 2.75 KB
/
store.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package storage
import (
"github.com/MixinNetwork/mixin/common"
"github.com/MixinNetwork/mixin/crypto"
)
type Store interface {
Close() error
StateGet(key string, val interface{}) (bool, error)
StateSet(key string, val interface{}) error
CheckGenesisLoad() (bool, error)
LoadGenesis(rounds []*common.Round, snapshots []*common.SnapshotWithTopologicalOrder, transactions []*common.VersionedTransaction) error
ReadConsensusNodes() []*common.Node
ReadAllNodes() []*common.Node
AddNodeOperation(tx *common.VersionedTransaction, timestamp, threshold uint64) error
CheckTransactionInNode(nodeId, hash crypto.Hash) (bool, error)
ReadTransaction(hash crypto.Hash) (*common.VersionedTransaction, string, error)
WriteTransaction(tx *common.VersionedTransaction) error
StartNewRound(node crypto.Hash, number uint64, references *common.RoundLink, finalStart uint64) error
UpdateEmptyHeadRound(node crypto.Hash, number uint64, references *common.RoundLink) error
TopologySequence() uint64
ReadUTXO(hash crypto.Hash, index int) (*common.UTXOWithLock, error)
LockUTXO(hash crypto.Hash, index int, tx crypto.Hash, fork bool) error
CheckDepositInput(deposit *common.DepositData, tx crypto.Hash) error
LockDepositInput(deposit *common.DepositData, tx crypto.Hash, fork bool) error
CheckGhost(key crypto.Key) (bool, error)
CheckSnapshot(hash crypto.Hash) (bool, error)
ReadSnapshot(hash crypto.Hash) (*common.SnapshotWithTopologicalOrder, error)
ReadSnapshotsSinceTopology(offset, count uint64) ([]*common.SnapshotWithTopologicalOrder, error)
ReadSnapshotWithTransactionsSinceTopology(topologyOffset, count uint64) ([]*common.SnapshotWithTopologicalOrder, []*common.VersionedTransaction, error)
ReadSnapshotsForNodeRound(nodeIdWithNetwork crypto.Hash, round uint64) ([]*common.SnapshotWithTopologicalOrder, error)
ReadRound(hash crypto.Hash) (*common.Round, error)
ReadLink(from, to crypto.Hash) (uint64, error)
WriteSnapshot(*common.SnapshotWithTopologicalOrder) error
ReadDomains() []common.Domain
QueueInfo() (uint64, uint64, error)
QueueAppendSnapshot(peerId crypto.Hash, snap *common.Snapshot, finalized bool) error
QueuePollSnapshots(hook func(peerId crypto.Hash, snap *common.Snapshot) error)
CachePutTransaction(tx *common.VersionedTransaction) error
CacheGetTransaction(hash crypto.Hash) (*common.VersionedTransaction, error)
CacheListTransactions(hook func(tx *common.VersionedTransaction) error) error
ReadLastMintDistribution(group string) (*common.MintDistribution, error)
LockMintInput(mint *common.MintData, tx crypto.Hash, fork bool) error
ReadMintDistributions(group string, offset, count uint64) ([]*common.MintDistribution, []*common.VersionedTransaction, error)
RemoveGraphEntries(prefix string) error
ValidateGraphEntries(networkId crypto.Hash) (int, int, error)
}