Skip to content

Commit

Permalink
refactor: reuse some dbpack code
Browse files Browse the repository at this point in the history
  • Loading branch information
dk-lockdown committed Jul 29, 2022
1 parent 1f4310a commit 16f7dd6
Show file tree
Hide file tree
Showing 20 changed files with 83 additions and 3,016 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
test:
strategy:
matrix:
go-version: [ 1.16.x ]
go-version: [ 1.18.x ]
# The type of runner that the job will run on
runs-on: ubuntu-latest

Expand Down
10 changes: 0 additions & 10 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ linters:
- misspell
- goimports

linters-settings:
staticcheck:
# Select the Go version to target.
# Default: 1.13
# Deprecated: use the global `run.go` instead.
go: "1.16"
# https://staticcheck.io/docs/options#checks
# Default: ["*"]
checks: ["all", "-SA1029"]

issues:
exclude-rules:
# Exclude some linters from running on tests files.
Expand Down
49 changes: 44 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,61 @@
module github.com/cectc/hptx

go 1.16
go 1.18

require (
github.com/cectc/dbpack v0.2.0
github.com/cectc/dbpack v0.3.1
github.com/dubbogo/gost v1.12.3
github.com/gogo/protobuf v1.3.2
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.7.1
go.etcd.io/etcd/api/v3 v3.5.3
go.etcd.io/etcd/client/v3 v3.5.3
google.golang.org/grpc v1.46.2
gopkg.in/yaml.v2 v2.4.0
k8s.io/client-go v0.23.6
)

require (
github.com/gin-gonic/gin v1.5.0
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
github.com/pingcap/errors v0.11.5-0.20211009033009-93128226aaa3 // indirect
github.com/pingcap/log v0.0.0-20211215031037-e024ba4eb0ee // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
go.etcd.io/etcd/api/v3 v3.5.3 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.3 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v3 v3.0.0 // indirect
k8s.io/apimachinery v0.23.6 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect
)

require (
github.com/gin-gonic/gin v1.7.0
golang.org/x/net v0.0.0-20220517181318-183a9ca12b87 // indirect
google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335 // indirect
)
532 changes: 17 additions & 515 deletions go.sum

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,16 @@ import (
"github.com/cectc/hptx/pkg/config"
"github.com/cectc/hptx/pkg/core"
"github.com/cectc/hptx/pkg/resource"
"github.com/cectc/hptx/pkg/storage"
"github.com/cectc/hptx/pkg/storage/etcd"
"github.com/cectc/hptx/pkg/tcc"
)

func InitFromFile(path string) {
conf := config.InitDistributedTransaction(path)
resource.InitTCCBranchResource(tcc.GetResourceManager())
driver := etcd.NewEtcdStore(conf.EtcdConfig)
storage.InitStorageDriver(driver)
core.InitDistributedTransactionManager(conf)
}

func InitWithConf(conf *config.DistributedTransaction) {
resource.InitTCCBranchResource(tcc.GetResourceManager())
driver := etcd.NewEtcdStore(conf.EtcdConfig)
storage.InitStorageDriver(driver)
core.InitDistributedTransactionManager(conf)
}
Loading

0 comments on commit 16f7dd6

Please sign in to comment.