blob: c49a6253cc04e2af903bf026963a8de277dd0aa7 (
plain)
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
|
package blockinfodatabase
import (
"Chain/pkg/utils"
"github.com/syndtr/goleveldb/leveldb"
)
// BlockInfoDatabase is a wrapper for a levelDB
type BlockInfoDatabase struct {
db *leveldb.DB
}
// New returns a BlockInfoDatabase given a Config
func New(config *Config) *BlockInfoDatabase {
db, err := leveldb.OpenFile(config.DatabasePath, nil)
if err != nil {
utils.Debug.Printf("Unable to initialize BlockInfoDatabase with path {%v}", config.DatabasePath)
}
return &BlockInfoDatabase{db: db}
}
// StoreBlockRecord stores a BlockRecord in the BlockInfoDatabase.
func (blockInfoDB *BlockInfoDatabase) StoreBlockRecord(hash string, blockRecord *BlockRecord) {
//TODO
}
// GetBlockRecord returns a BlockRecord from the BlockInfoDatabase given
// the relevant block's hash.
func (blockInfoDB *BlockInfoDatabase) GetBlockRecord(hash string) *BlockRecord {
//TODO
return nil
}
|