/
store.go
18 lines (17 loc) · 915 Bytes
/
store.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package types
// Store defines an interface required for the implementation
// of a data structure for creating and reading ledgers and transactions.
type Store interface {
Connect(dbAddr string) (interface{}, error)
Init(systemPublicLedgerName, systemPrivateLedgerName string) error
SetBlockchainImplementation(b Blockchain)
GetImplementationName() string
CreateLedger(cocoonID, name string, chained, public bool) (*Ledger, error)
CreateLedgerThen(cocoonID, name string, chained, public bool, then func() error) (*Ledger, error)
GetLedger(name string) (*Ledger, error)
Put(ledger string, txs []*Transaction) ([]*TxReceipt, error)
PutThen(ledger string, txs []*Transaction, then func(validTxs []*Transaction) error) ([]*TxReceipt, error)
Get(ledger, key string) (*Transaction, error)
GetRange(ledger, startKey, endKey string, inclusive bool, limit, lastNum int) ([]*Transaction, error)
Close() error
}