2021-08-23 10:35:48 +02:00
|
|
|
//go:build kvdb_etcd
|
2020-05-15 16:59:37 +02:00
|
|
|
// +build kvdb_etcd
|
|
|
|
|
|
|
|
package kvdb
|
|
|
|
|
|
|
|
import (
|
2021-04-26 19:08:11 +02:00
|
|
|
"github.com/lightningnetwork/lnd/kvdb/etcd"
|
2020-05-15 16:59:37 +02:00
|
|
|
)
|
|
|
|
|
2022-12-14 09:07:14 +01:00
|
|
|
// EtcdBackend is conditionally set to etcd when the kvdb_etcd build tag is
|
2020-05-15 16:59:37 +02:00
|
|
|
// defined, allowing testing our database code with etcd backend.
|
2022-12-14 09:07:14 +01:00
|
|
|
const EtcdBackend = true
|
2020-05-15 16:59:37 +02:00
|
|
|
|
|
|
|
// GetEtcdTestBackend creates an embedded etcd backend for testing
|
|
|
|
// storig the database at the passed path.
|
2021-09-08 15:10:11 +02:00
|
|
|
func StartEtcdTestBackend(path string, clientPort, peerPort uint16,
|
|
|
|
logFile string) (*etcd.Config, func(), error) {
|
2021-01-06 19:40:30 +01:00
|
|
|
|
2021-02-09 17:44:43 +01:00
|
|
|
return etcd.NewEmbeddedEtcdInstance(
|
2021-09-08 15:10:11 +02:00
|
|
|
path, clientPort, peerPort, logFile,
|
2021-01-06 19:40:30 +01:00
|
|
|
)
|
2020-05-15 16:59:37 +02:00
|
|
|
}
|