From 23c7f503e0fb4c7143808a053ce41442dea9d5f8 Mon Sep 17 00:00:00 2001 From: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com> Date: Wed, 24 Aug 2022 11:02:47 +0200 Subject: [PATCH] WithTablessCfg -> WithTableCfg (#601) --- kv/mdbx/kv_abstract_test.go | 6 +++--- kv/mdbx/kv_mdbx.go | 2 +- kv/mdbx/kv_mdbx_test.go | 2 +- kv/mdbx/kv_migrator_test.go | 4 ++-- kv/memdb/memory_database.go | 6 +++--- state/domain_test.go | 2 +- state/history_test.go | 2 +- state/inverted_index_test.go | 2 +- txpool/txpooluitl/all_components.go | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/kv/mdbx/kv_abstract_test.go b/kv/mdbx/kv_abstract_test.go index 86b78eeec..7f967baec 100644 --- a/kv/mdbx/kv_abstract_test.go +++ b/kv/mdbx/kv_abstract_test.go @@ -166,7 +166,7 @@ func TestRemoteKvVersion(t *testing.T) { f := func(defaultBuckets kv.TableCfg) kv.TableCfg { return defaultBuckets } - writeDB := mdbx.NewMDBX(logger).InMem().WithTablessCfg(f).MustOpen() + writeDB := mdbx.NewMDBX(logger).InMem().WithTableCfg(f).MustOpen() defer writeDB.Close() conn := bufconn.Listen(1024 * 1024) grpcServer := grpc.NewServer() @@ -210,8 +210,8 @@ func setupDatabases(t *testing.T, logger log.Logger, f mdbx.TableCfgFunc) (write t.Helper() ctx := context.Background() writeDBs = []kv.RwDB{ - mdbx.NewMDBX(logger).InMem().WithTablessCfg(f).MustOpen(), - mdbx.NewMDBX(logger).InMem().WithTablessCfg(f).MustOpen(), // for remote db + mdbx.NewMDBX(logger).InMem().WithTableCfg(f).MustOpen(), + mdbx.NewMDBX(logger).InMem().WithTableCfg(f).MustOpen(), // for remote db } conn := bufconn.Listen(1024 * 1024) diff --git a/kv/mdbx/kv_mdbx.go b/kv/mdbx/kv_mdbx.go index 649e10ea5..a6302a6af 100644 --- a/kv/mdbx/kv_mdbx.go +++ b/kv/mdbx/kv_mdbx.go @@ -159,7 +159,7 @@ func (opts MdbxOpts) WriteMap() MdbxOpts { return opts } -func (opts MdbxOpts) WithTablessCfg(f TableCfgFunc) MdbxOpts { +func (opts MdbxOpts) WithTableCfg(f TableCfgFunc) MdbxOpts { opts.bucketsCfg = f return opts } diff --git a/kv/mdbx/kv_mdbx_test.go b/kv/mdbx/kv_mdbx_test.go index e949be5bc..b24f91324 100644 --- a/kv/mdbx/kv_mdbx_test.go +++ b/kv/mdbx/kv_mdbx_test.go @@ -30,7 +30,7 @@ func BaseCase(t *testing.T) (kv.RwDB, kv.RwTx, kv.RwCursorDupSort) { path := t.TempDir() logger := log.New() table := "Table" - db := NewMDBX(logger).Path(path).WithTablessCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { + db := NewMDBX(logger).Path(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TableCfg{ table: kv.TableCfgItem{Flags: kv.DupSort}, kv.Sequence: kv.TableCfgItem{}, diff --git a/kv/mdbx/kv_migrator_test.go b/kv/mdbx/kv_migrator_test.go index 3157ec892..db928842c 100644 --- a/kv/mdbx/kv_migrator_test.go +++ b/kv/mdbx/kv_migrator_test.go @@ -100,14 +100,14 @@ func TestBucketCRUD(t *testing.T) { func TestReadOnlyMode(t *testing.T) { path := t.TempDir() logger := log.New() - db1 := mdbx.NewMDBX(logger).Path(path).WithTablessCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { + db1 := mdbx.NewMDBX(logger).Path(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TableCfg{ kv.Headers: kv.TableCfgItem{}, } }).MustOpen() db1.Close() - db2 := mdbx.NewMDBX(logger).Readonly().Path(path).WithTablessCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { + db2 := mdbx.NewMDBX(logger).Readonly().Path(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TableCfg{ kv.Headers: kv.TableCfgItem{}, } diff --git a/kv/memdb/memory_database.go b/kv/memdb/memory_database.go index 4153345f8..73bf24818 100644 --- a/kv/memdb/memory_database.go +++ b/kv/memdb/memory_database.go @@ -31,13 +31,13 @@ func New() kv.RwDB { } func NewPoolDB() kv.RwDB { - return mdbx.NewMDBX(log.New()).InMem().Label(kv.TxPoolDB).WithTablessCfg(func(_ kv.TableCfg) kv.TableCfg { return kv.TxpoolTablesCfg }).MustOpen() + return mdbx.NewMDBX(log.New()).InMem().Label(kv.TxPoolDB).WithTableCfg(func(_ kv.TableCfg) kv.TableCfg { return kv.TxpoolTablesCfg }).MustOpen() } func NewDownloaderDB() kv.RwDB { - return mdbx.NewMDBX(log.New()).InMem().Label(kv.DownloaderDB).WithTablessCfg(func(_ kv.TableCfg) kv.TableCfg { return kv.DownloaderTablesCfg }).MustOpen() + return mdbx.NewMDBX(log.New()).InMem().Label(kv.DownloaderDB).WithTableCfg(func(_ kv.TableCfg) kv.TableCfg { return kv.DownloaderTablesCfg }).MustOpen() } func NewSentryDB() kv.RwDB { - return mdbx.NewMDBX(log.New()).InMem().Label(kv.SentryDB).WithTablessCfg(func(_ kv.TableCfg) kv.TableCfg { return kv.SentryTablesCfg }).MustOpen() + return mdbx.NewMDBX(log.New()).InMem().Label(kv.SentryDB).WithTableCfg(func(_ kv.TableCfg) kv.TableCfg { return kv.SentryTablesCfg }).MustOpen() } func NewTestDB(tb testing.TB) kv.RwDB { diff --git a/state/domain_test.go b/state/domain_test.go index 32937e4f9..04885462e 100644 --- a/state/domain_test.go +++ b/state/domain_test.go @@ -40,7 +40,7 @@ func testDbAndDomain(t *testing.T, prefixLen int) (string, kv.RwDB, *Domain) { historyValsTable := "HistoryVals" settingsTable := "Settings" indexTable := "Index" - db := mdbx.NewMDBX(logger).Path(path).WithTablessCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { + db := mdbx.NewMDBX(logger).Path(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TableCfg{ keysTable: kv.TableCfgItem{Flags: kv.DupSort}, valsTable: kv.TableCfgItem{}, diff --git a/state/history_test.go b/state/history_test.go index cab2a40d6..4ca645c87 100644 --- a/state/history_test.go +++ b/state/history_test.go @@ -39,7 +39,7 @@ func testDbAndHistory(t *testing.T) (string, kv.RwDB, *History) { indexTable := "Index" valsTable := "Vals" settingsTable := "Settings" - db := mdbx.NewMDBX(logger).Path(path).WithTablessCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { + db := mdbx.NewMDBX(logger).Path(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TableCfg{ keysTable: kv.TableCfgItem{Flags: kv.DupSort}, indexTable: kv.TableCfgItem{Flags: kv.DupSort}, diff --git a/state/inverted_index_test.go b/state/inverted_index_test.go index de0c4f4c9..002bc242b 100644 --- a/state/inverted_index_test.go +++ b/state/inverted_index_test.go @@ -36,7 +36,7 @@ func testDbAndInvertedIndex(t *testing.T) (string, kv.RwDB, *InvertedIndex) { logger := log.New() keysTable := "Keys" indexTable := "Index" - db := mdbx.NewMDBX(logger).Path(path).WithTablessCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { + db := mdbx.NewMDBX(logger).Path(path).WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TableCfg{ keysTable: kv.TableCfgItem{Flags: kv.DupSort}, indexTable: kv.TableCfgItem{Flags: kv.DupSort}, diff --git a/txpool/txpooluitl/all_components.go b/txpool/txpooluitl/all_components.go index 512b92158..1f6653eb4 100644 --- a/txpool/txpooluitl/all_components.go +++ b/txpool/txpooluitl/all_components.go @@ -100,7 +100,7 @@ func SaveChainConfigIfNeed(ctx context.Context, coreDB kv.RoDB, txPoolDB kv.RwDB func AllComponents(ctx context.Context, cfg txpool.Config, cache kvcache.Cache, newTxs chan types.Hashes, chainDB kv.RoDB, sentryClients []direct.SentryClient, stateChangesClient txpool.StateChangesClient) (kv.RwDB, *txpool.TxPool, *txpool.Fetch, *txpool.Send, *txpool.GrpcServer, error) { txPoolDB, err := mdbx.NewMDBX(log.New()).Label(kv.TxPoolDB).Path(cfg.DBDir). - WithTablessCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TxpoolTablesCfg }). + WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TxpoolTablesCfg }). Flags(func(f uint) uint { return f ^ mdbx2.Durable | mdbx2.SafeNoSync }). GrowthStep(16 * datasize.MB). SyncPeriod(30 * time.Second).