From 030fa1e4d831850d4a14aef7932905dd48e675d0 Mon Sep 17 00:00:00 2001 From: evgeniy-scherbina Date: Mon, 24 Jun 2024 12:50:31 -0400 Subject: [PATCH] TMP Commit --- cmd/opendb/run.sh | 3 --- go.mod | 6 +++--- server/start.go | 28 +++++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 7 deletions(-) delete mode 100755 cmd/opendb/run.sh diff --git a/cmd/opendb/run.sh b/cmd/opendb/run.sh deleted file mode 100755 index db3ddd1d90..0000000000 --- a/cmd/opendb/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -CGO_CFLAGS="-I/opt/homebrew/opt/rocksdb/include" \ -CGO_LDFLAGS="-L/opt/homebrew/opt/rocksdb/lib -lrocksdb -lstdc++ -lm -lz -L/opt/homebrew/opt/snappy/lib -L/opt/homebrew/opt/lz4/lib -L/opt/homebrew/opt/zstd/lib" \ - go test -v -tags=rocksdb \ No newline at end of file diff --git a/go.mod b/go.mod index ed85606702..77e242788c 100644 --- a/go.mod +++ b/go.mod @@ -21,6 +21,7 @@ require ( github.com/cosmos/ibc-go/v7 v7.3.1 github.com/davecgh/go-spew v1.1.1 github.com/ethereum/go-ethereum v1.10.26 + github.com/go-kit/kit v0.12.0 github.com/gogo/protobuf v1.3.2 github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.0 @@ -28,9 +29,11 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/holiman/uint256 v1.2.1 github.com/improbable-eng/grpc-web v0.15.0 + github.com/linxGnu/grocksdb v1.8.6 github.com/onsi/ginkgo/v2 v2.9.1 github.com/onsi/gomega v1.27.4 github.com/pkg/errors v0.9.1 + github.com/prometheus/client_golang v1.14.0 github.com/rakyll/statik v0.1.7 github.com/rs/cors v1.8.3 github.com/spf13/cast v1.5.1 @@ -105,7 +108,6 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/getsentry/sentry-go v0.23.0 // indirect - github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.2.4 // indirect @@ -153,7 +155,6 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/linxGnu/grocksdb v1.8.6 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -170,7 +171,6 @@ require ( github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect diff --git a/server/start.go b/server/start.go index a521d0a147..2add1e989b 100644 --- a/server/start.go +++ b/server/start.go @@ -295,6 +295,32 @@ func startStandAlone(ctx *server.Context, opts StartOptions) error { return server.WaitForQuitSignals() } +// DefaultDBProvider returns a database using the DBBackend and DBDir +// specified in the ctx.Config. +func DefaultDBProvider(ctx *node.DBContext) (dbm.DB, error) { + // appOpts types.AppOptions, home string, backendType dbm.BackendType + // opendb.OpenDB() + + dbType := dbm.BackendType(ctx.Config.DBBackend) + + fmt.Printf("############################## Stack ##############################\n") + fmt.Printf("ctx.ID : name : %v\n", ctx.ID) + fmt.Printf("dbType : backend: %v\n", dbType) + fmt.Printf("ctx.Config.DBDir(): dir : %v\n", ctx.Config.DBDir()) + + fmt.Printf("RootDir : %v\n", ctx.Config.RootDir) + fmt.Printf("DBPath : %v\n", ctx.Config.DBPath) + fmt.Printf("############################## Stack ##############################\n") + + // name string, backend BackendType, dir string + + // ctx.ID : name : blockstore + // dbType : backend: rocksdb + // ctx.Config.DBDir(): dir : /root/.kava/data + + return dbm.NewDB(ctx.ID, dbType, ctx.Config.DBDir()) +} + // legacyAminoCdc is used for the legacy REST API func startInProcess(ctx *server.Context, clientCtx client.Context, opts StartOptions) (err error) { cfg := ctx.Config @@ -385,7 +411,7 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, opts StartOpt nodeKey, proxy.NewLocalClientCreator(app), genDocProvider, - node.DefaultDBProvider, + DefaultDBProvider, node.DefaultMetricsProvider(cfg.Instrumentation), ctx.Logger.With("server", "node"), )