• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revision427c35b9e245a2a7f144fb1cd7af4f0a7456df91 (tree)
Time2019-07-15 15:18:20
Authormars <mars@byto...>
Commitermars

Log Message

rename dir

Change Summary

  • modified: cmd/fedd/main.go (diff)
  • add: toolbar/common/config.go (diff)
  • delete: {federation => toolbar/federation}/api/common.go
  • delete: {federation => toolbar/federation}/api/display.go
  • delete: {federation => toolbar/federation}/api/errors.go
  • delete: {federation => toolbar/federation}/api/handler.go
  • delete: {federation => toolbar/federation}/api/pagination.go
  • delete: {federation => toolbar/federation}/api/response.go
  • delete: {federation => toolbar/federation}/api/server.go
  • delete: {federation => toolbar/federation}/common/const.go
  • delete: {federation => toolbar/federation}/common/util.go
  • delete: {federation => toolbar/federation}/config/config.go
  • delete: {federation => toolbar/federation}/database/asset_store.go
  • delete: {federation => toolbar/federation}/database/orm/asset.go
  • delete: {federation => toolbar/federation}/database/orm/chain.go
  • delete: {federation => toolbar/federation}/database/orm/cross_transaction.go
  • delete: {federation => toolbar/federation}/database/orm/cross_transaction_req.go
  • delete: {federation => toolbar/federation}/service/node.go
  • delete: {federation => toolbar/federation}/synchron/errors.go
  • delete: {federation => toolbar/federation}/synchron/mainchain_keeper.go
  • delete: {federation => toolbar/federation}/synchron/sidechain_keeper.go
  • delete: {federation => toolbar/federation}/types/types.go
  • delete: {federation => toolbar/federation}/util/http_util.go
  • delete: {federation/database => toolbar/common}/db.go

Incremental Difference

--- a/cmd/fedd/main.go
+++ b/cmd/fedd/main.go
@@ -5,15 +5,16 @@ import (
55
66 log "github.com/sirupsen/logrus"
77
8- "github.com/vapor/federation/api"
9- "github.com/vapor/federation/config"
10- "github.com/vapor/federation/database"
11- "github.com/vapor/federation/synchron"
8+ "github.com/vapor/toolbar/federation/api"
9+ "github.com/vapor/toolbar/federation/config"
10+ "github.com/vapor/toolbar/federation/database"
11+ "github.com/vapor/toolbar/common"
12+ "github.com/vapor/toolbar/federation/synchron"
1213 )
1314
1415 func main() {
1516 cfg := config.NewConfig()
16- db, err := database.NewMySQLDB(cfg.MySQLConfig)
17+ db, err := common.NewMySQLDB(cfg.MySQLConfig)
1718 if err != nil {
1819 log.WithField("err", err).Panic("initialize mysql db error")
1920 }
--- /dev/null
+++ b/toolbar/common/config.go
@@ -0,0 +1,14 @@
1+package common
2+
3+type MySQLConfig struct {
4+ Connection MySQLConnection `json:"connection"`
5+ LogMode bool `json:"log_mode"`
6+}
7+
8+type MySQLConnection struct {
9+ Host string `json:"host"`
10+ Port uint `json:"port"`
11+ Username string `json:"username"`
12+ Password string `json:"password"`
13+ DbName string `json:"database"`
14+}
--- a/federation/database/db.go
+++ b/toolbar/common/db.go
@@ -1,4 +1,4 @@
1-package database
1+package common
22
33 import (
44 "fmt"
@@ -7,10 +7,9 @@ import (
77 "github.com/jinzhu/gorm"
88
99 "github.com/vapor/errors"
10- "github.com/vapor/federation/config"
1110 )
1211
13-func NewMySQLDB(cfg config.MySQLConfig) (*gorm.DB, error) {
12+func NewMySQLDB(cfg MySQLConfig) (*gorm.DB, error) {
1413 dsnTemplate := "%s:%s@tcp(%s:%d)/%s?charset=utf8&parseTime=true&loc=Local"
1514 dsn := fmt.Sprintf(dsnTemplate, cfg.Connection.Username, cfg.Connection.Password, cfg.Connection.Host, cfg.Connection.Port, cfg.Connection.DbName)
1615 db, err := gorm.Open("mysql", dsn)
--- a/federation/api/handler.go
+++ b/toolbar/federation/api/handler.go
@@ -8,8 +8,8 @@ import (
88 "github.com/gin-gonic/gin"
99
1010 "github.com/vapor/errors"
11- "github.com/vapor/federation/common"
12- "github.com/vapor/federation/database/orm"
11+ "github.com/vapor/toolbar/federation/common"
12+ "github.com/vapor/toolbar/federation/database/orm"
1313 )
1414
1515 type listCrosschainTxsReq struct{ Display }
--- a/federation/api/server.go
+++ b/toolbar/federation/api/server.go
@@ -10,7 +10,7 @@ import (
1010 "github.com/jinzhu/gorm"
1111
1212 "github.com/vapor/errors"
13- "github.com/vapor/federation/config"
13+ "github.com/vapor/toolbar/federation/config"
1414 )
1515
1616 type Server struct {
--- a/federation/config/config.go
+++ b/toolbar/federation/config/config.go
@@ -7,6 +7,7 @@ import (
77 log "github.com/sirupsen/logrus"
88
99 vaporJson "github.com/vapor/encoding/json"
10+ "github.com/vapor/toolbar/common"
1011 )
1112
1213 func NewConfig() *Config {
@@ -34,7 +35,7 @@ func NewConfigWithPath(path string) *Config {
3435
3536 type Config struct {
3637 API API `json:"api"`
37- MySQLConfig MySQLConfig `json:"mysql"`
38+ MySQLConfig common.MySQLConfig `json:"mysql"`
3839 FederationProg vaporJson.HexBytes `json:"federation_prog"`
3940 Mainchain Chain `json:"mainchain"`
4041 Sidechain Chain `json:"sidechain"`
@@ -44,19 +45,6 @@ type API struct {
4445 IsReleaseMode bool `json:"is_release_mode"`
4546 }
4647
47-type MySQLConfig struct {
48- Connection MySQLConnection `json:"connection"`
49- LogMode bool `json:"log_mode"`
50-}
51-
52-type MySQLConnection struct {
53- Host string `json:"host"`
54- Port uint `json:"port"`
55- Username string `json:"username"`
56- Password string `json:"password"`
57- DbName string `json:"database"`
58-}
59-
6048 type Chain struct {
6149 Name string `json:"name"`
6250 Upstream string `json:"upstream"`
--- a/federation/database/asset_store.go
+++ b/toolbar/federation/database/asset_store.go
@@ -7,7 +7,7 @@ import (
77 "github.com/jinzhu/gorm"
88
99 "github.com/vapor/errors"
10- "github.com/vapor/federation/database/orm"
10+ "github.com/vapor/toolbar/federation/database/orm"
1111 )
1212
1313 const (
--- a/federation/database/orm/asset.go
+++ b/toolbar/federation/database/orm/asset.go
@@ -1,7 +1,7 @@
11 package orm
22
33 import (
4- "github.com/vapor/federation/types"
4+ "github.com/vapor/toolbar/federation/types"
55 )
66
77 type Asset struct {
--- a/federation/database/orm/chain.go
+++ b/toolbar/federation/database/orm/chain.go
@@ -1,7 +1,7 @@
11 package orm
22
33 import (
4- "github.com/vapor/federation/types"
4+ "github.com/vapor/toolbar/federation/types"
55 )
66
77 type Chain struct {
--- a/federation/database/orm/cross_transaction.go
+++ b/toolbar/federation/database/orm/cross_transaction.go
@@ -5,8 +5,8 @@ import (
55 "encoding/json"
66
77 "github.com/vapor/errors"
8- "github.com/vapor/federation/common"
9- "github.com/vapor/federation/types"
8+ "github.com/vapor/toolbar/federation/common"
9+ "github.com/vapor/toolbar/federation/types"
1010 )
1111
1212 type CrossTransaction struct {
--- a/federation/database/orm/cross_transaction_req.go
+++ b/toolbar/federation/database/orm/cross_transaction_req.go
@@ -1,7 +1,7 @@
11 package orm
22
33 import (
4- "github.com/vapor/federation/types"
4+ "github.com/vapor/toolbar/federation/types"
55 )
66
77 type CrossTransactionReq struct {
--- a/federation/service/node.go
+++ b/toolbar/federation/service/node.go
@@ -4,7 +4,7 @@ import (
44 "encoding/json"
55
66 "github.com/vapor/errors"
7- "github.com/vapor/federation/util"
7+ "github.com/vapor/toolbar/federation/util"
88 "github.com/vapor/protocol/bc"
99 )
1010
--- a/federation/synchron/mainchain_keeper.go
+++ b/toolbar/federation/synchron/mainchain_keeper.go
@@ -16,11 +16,11 @@ import (
1616
1717 "github.com/vapor/consensus"
1818 "github.com/vapor/errors"
19- "github.com/vapor/federation/common"
20- "github.com/vapor/federation/config"
21- "github.com/vapor/federation/database"
22- "github.com/vapor/federation/database/orm"
23- "github.com/vapor/federation/service"
19+ "github.com/vapor/toolbar/federation/common"
20+ "github.com/vapor/toolbar/federation/config"
21+ "github.com/vapor/toolbar/federation/database"
22+ "github.com/vapor/toolbar/federation/database/orm"
23+ "github.com/vapor/toolbar/federation/service"
2424 "github.com/vapor/protocol/bc"
2525 )
2626
--- a/federation/synchron/sidechain_keeper.go
+++ b/toolbar/federation/synchron/sidechain_keeper.go
@@ -11,11 +11,11 @@ import (
1111
1212 "github.com/vapor/consensus"
1313 "github.com/vapor/errors"
14- "github.com/vapor/federation/common"
15- "github.com/vapor/federation/config"
16- "github.com/vapor/federation/database"
17- "github.com/vapor/federation/database/orm"
18- "github.com/vapor/federation/service"
14+ "github.com/vapor/toolbar/federation/common"
15+ "github.com/vapor/toolbar/federation/config"
16+ "github.com/vapor/toolbar/federation/database"
17+ "github.com/vapor/toolbar/federation/database/orm"
18+ "github.com/vapor/toolbar/federation/service"
1919 "github.com/vapor/protocol/bc"
2020 "github.com/vapor/protocol/bc/types"
2121 )
Show on old repository browser