mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 06:32:18 +02:00
lncfg+itest: expose configurable batch-commit-interval
This will permit a greater degree of tuning or customization depending on various hardware/environmental factors.
This commit is contained in:
13
lncfg/db.go
13
lncfg/db.go
@@ -3,20 +3,24 @@ package lncfg
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/lightningnetwork/lnd/channeldb/kvdb"
|
||||
)
|
||||
|
||||
const (
|
||||
dbName = "channel.db"
|
||||
BoltBackend = "bolt"
|
||||
EtcdBackend = "etcd"
|
||||
dbName = "channel.db"
|
||||
BoltBackend = "bolt"
|
||||
EtcdBackend = "etcd"
|
||||
DefaultBatchCommitInterval = 500 * time.Millisecond
|
||||
)
|
||||
|
||||
// DB holds database configuration for LND.
|
||||
type DB struct {
|
||||
Backend string `long:"backend" description:"The selected database backend."`
|
||||
|
||||
BatchCommitInterval time.Duration `long:"batch-commit-interval" description:"The maximum duration the channel graph batch schedulers will wait before attempting to commit a batch of pending updates. This can be tradeoff database contenion for commit latency."`
|
||||
|
||||
Etcd *kvdb.EtcdConfig `group:"etcd" namespace:"etcd" description:"Etcd settings."`
|
||||
|
||||
Bolt *kvdb.BoltConfig `group:"bolt" namespace:"bolt" description:"Bolt settings."`
|
||||
@@ -25,7 +29,8 @@ type DB struct {
|
||||
// NewDB creates and returns a new default DB config.
|
||||
func DefaultDB() *DB {
|
||||
return &DB{
|
||||
Backend: BoltBackend,
|
||||
Backend: BoltBackend,
|
||||
BatchCommitInterval: DefaultBatchCommitInterval,
|
||||
Bolt: &kvdb.BoltConfig{
|
||||
AutoCompactMinAge: kvdb.DefaultBoltAutoCompactMinAge,
|
||||
},
|
||||
|
Reference in New Issue
Block a user