multi: itest jobs with SQL graph backend
In this commit, a new `test_native_sql` build flag is defined. If this build flag is used along with the `--use-native-sql` config option, then the SQLStore implementation of the graphdb.V1Store will be initialised. This is then used to run our itest suite against the new SQLStore graph implementation. NOTE that this only works for new nodes currently - the migration from kv-to-sql is yet to be implemeneted.
This commit is contained in:
6 files changed
+88
-21
No files matched your search
@@ -0,0 +1,31 @@
|
||||
//go:build test_native_sql
|
||||
|
||||
package lnd
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
graphdb "github.com/lightningnetwork/lnd/graph/db"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
"github.com/lightningnetwork/lnd/sqldb"
|
||||
)
|
||||
|
||||
// getGraphStore returns a graphdb.V1Store backed by a graphdb.SQLStore
|
||||
// implementation.
|
||||
func (d *DefaultDatabaseBuilder) getGraphStore(baseDB *sqldb.BaseDB,
|
||||
_ kvdb.Backend, opts ...graphdb.StoreOptionModifier) (graphdb.V1Store,
|
||||
error) {
|
||||
|
||||
graphExecutor := sqldb.NewTransactionExecutor(
|
||||
baseDB, func(tx *sql.Tx) graphdb.SQLQueries {
|
||||
return baseDB.WithTx(tx)
|
||||
},
|
||||
)
|
||||
|
||||
return graphdb.NewSQLStore(
|
||||
&graphdb.SQLStoreConfig{
|
||||
ChainHash: *d.cfg.ActiveNetParams.GenesisHash,
|
||||
},
|
||||
graphExecutor, opts...,
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user