OSDN Git Service

rm db_keeper
authorHAOYUatHZ <haoyu@protonmail.com>
Thu, 6 Jun 2019 06:48:36 +0000 (14:48 +0800)
committerHAOYUatHZ <haoyu@protonmail.com>
Thu, 6 Jun 2019 06:48:36 +0000 (14:48 +0800)
cmd/fedd/main.go
federation/synchron/block_keeper.go
federation/synchron/db_keeper.go [deleted file]

index 1e6da2c..6b57368 100644 (file)
@@ -17,8 +17,8 @@ func main() {
                log.WithField("err", err).Panic("initialize mysql db error")
        }
 
-       go synchron.NewDbKeeper(db, &cfg.Mainchain).Run()
-       go synchron.NewDbKeeper(db, &cfg.Sidechain).Run()
+       go synchron.NewBlockKeeper(db, &cfg.Mainchain).Run()
+       go synchron.NewBlockKeeper(db, &cfg.Sidechain).Run()
 
        // keep the main func running in case of terminating goroutines
        var wg sync.WaitGroup
index aa80b7f..15cb6bb 100644 (file)
@@ -23,6 +23,14 @@ type blockKeeper struct {
        // coinName string
 }
 
+func NewBlockKeeper(db *gorm.DB, chainCfg *config.Chain) *blockKeeper {
+       return &blockKeeper{
+               cfg:  chainCfg,
+               db:   db,
+               node: service.NewNode(chainCfg.Upstream.RPC),
+       }
+}
+
 func (b *blockKeeper) Run() {
 
 }
diff --git a/federation/synchron/db_keeper.go b/federation/synchron/db_keeper.go
deleted file mode 100644 (file)
index 2db8695..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-package synchron
-
-import (
-       // "time"
-
-       // "github.com/bytom/errors"
-       // "github.com/bytom/protocol/bc"
-       // "github.com/bytom/protocol/bc/types"
-       "github.com/jinzhu/gorm"
-       // log "github.com/sirupsen/logrus"
-
-       "github.com/vapor/federation/config"
-       // "github.com/blockcenter/database"
-       // "github.com/blockcenter/database/orm"
-       "github.com/vapor/federation/service"
-)
-
-type DbKeeper struct {
-       blockKeeper *blockKeeper
-}
-
-func NewDbKeeper(db *gorm.DB, chainCfg *config.Chain) *DbKeeper {
-       blockKeeper := &blockKeeper{
-               cfg:  chainCfg,
-               db:   db,
-               node: service.NewNode(chainCfg.Upstream.RPC),
-       }
-
-       return &DbKeeper{blockKeeper}
-}
-
-func (d *DbKeeper) Run() {
-       go d.blockKeeper.Run()
-}