refactor to work with v4 vdb geth v1.11.5
This commit is contained in:
parent
6fe54aa8b4
commit
5c13d59515
@ -19,12 +19,12 @@ package prom
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
"github.com/ethereum/go-ethereum/statediff/indexer/database/sql"
|
||||
mets "github.com/ethereum/go-ethereum/statediff/indexer/database/metrics"
|
||||
)
|
||||
|
||||
// DBStatsGetter is an interface that gets sql.DBStats.
|
||||
type DBStatsGetter interface {
|
||||
Stats() sql.Stats
|
||||
Stats() mets.DbStats
|
||||
}
|
||||
|
||||
// DBStatsCollector implements the prometheus.Collector interface.
|
||||
|
@ -9,9 +9,9 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/statediff/indexer/test_helpers"
|
||||
"github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres"
|
||||
"github.com/ethereum/go-ethereum/statediff/indexer/ipld"
|
||||
"github.com/ethereum/go-ethereum/statediff/indexer/test_helpers"
|
||||
|
||||
fixt "github.com/cerc-io/ipld-eth-state-snapshot/fixture"
|
||||
snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types"
|
||||
@ -91,7 +91,7 @@ func TestPgCopy(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
driver, err := postgres.NewSQLXDriver(ctx, pgConfig, nodeInfo)
|
||||
test.NoError(t, err)
|
||||
db := postgres.NewPostgresDB(driver)
|
||||
db := postgres.NewPostgresDB(driver, false)
|
||||
|
||||
test_helpers.TearDownDB(t, db)
|
||||
|
||||
|
@ -80,7 +80,7 @@ func TestCreateInPlaceSnapshot(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
driver, err := postgres.NewSQLXDriver(ctx, pgConfig, nodeInfo)
|
||||
test.NoError(t, err)
|
||||
db := postgres.NewPostgresDB(driver)
|
||||
db := postgres.NewPostgresDB(driver, false)
|
||||
|
||||
test_helpers.TearDownDB(t, db)
|
||||
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/statediff/indexer/test_helpers"
|
||||
"github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres"
|
||||
"github.com/ethereum/go-ethereum/statediff/indexer/ipld"
|
||||
"github.com/ethereum/go-ethereum/statediff/indexer/test_helpers"
|
||||
|
||||
fixt "github.com/cerc-io/ipld-eth-state-snapshot/fixture"
|
||||
snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types"
|
||||
@ -46,7 +46,7 @@ func TestBasic(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
driver, err := postgres.NewSQLXDriver(ctx, pgConfig, nodeInfo)
|
||||
test.NoError(t, err)
|
||||
db := postgres.NewPostgresDB(driver)
|
||||
db := postgres.NewPostgresDB(driver, false)
|
||||
|
||||
test_helpers.TearDownDB(t, db)
|
||||
|
||||
|
@ -30,10 +30,10 @@ import (
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
iter "github.com/ethereum/go-ethereum/trie/concurrent_iterator"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
iter "github.com/cerc-io/go-eth-state-node-iterator"
|
||||
"github.com/cerc-io/ipld-eth-state-snapshot/pkg/prom"
|
||||
. "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types"
|
||||
)
|
||||
@ -59,9 +59,8 @@ type Service struct {
|
||||
}
|
||||
|
||||
func NewLevelDB(con *EthConfig) (ethdb.Database, error) {
|
||||
edb, err := rawdb.NewLevelDBDatabaseWithFreezer(
|
||||
con.LevelDBPath, 1024, 256, con.AncientDBPath, "ipld-eth-state-snapshot", true,
|
||||
)
|
||||
kvdb, _ := rawdb.NewLevelDBDatabase(con.LevelDBPath, 1024, 256, "ipld-eth-state-snapshot", true)
|
||||
edb, err := rawdb.NewDatabaseWithFreezer(kvdb, con.AncientDBPath, "ipld-eth-state-snapshot", true)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to create NewLevelDBDatabaseWithFreezer: %s", err)
|
||||
}
|
||||
|
@ -11,9 +11,8 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
iter "github.com/ethereum/go-ethereum/trie/concurrent_iterator"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
iter "github.com/cerc-io/go-eth-state-node-iterator"
|
||||
)
|
||||
|
||||
type trackedIter struct {
|
||||
|
@ -23,7 +23,7 @@ func NewPublisher(mode SnapshotMode, config *Config) (snapt.Publisher, error) {
|
||||
|
||||
prom.RegisterDBCollector(config.DB.ConnConfig.DatabaseName, driver)
|
||||
|
||||
return pg.NewPublisher(postgres.NewPostgresDB(driver)), nil
|
||||
return pg.NewPublisher(postgres.NewPostgresDB(driver, false)), nil
|
||||
case FileSnapshot:
|
||||
return file.NewPublisher(config.File.OutputDir, config.Eth.NodeInfo)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user