lnd+kvdb: pass LND abort context to etcd

This commit is contained in:
Andras Banki-Horvath committed 2020-06-03 17:44:44 +02:00
1 parent d3545830c9
commit 3e5e60cac4
4 files changed
+19 -10

No files matched your search

+6 -1
View File
@@ -3,6 +3,8 @@
package kvdb
import (
"context"
"github.com/lightningnetwork/lnd/channeldb/kvdb/etcd"
)
@@ -12,10 +14,13 @@ const TestBackend = EtcdBackendName
// GetEtcdBackend returns an etcd backend configured according to the
// passed etcdConfig.
func GetEtcdBackend(prefix string, etcdConfig *EtcdConfig) (Backend, error) {
func GetEtcdBackend(ctx context.Context, prefix string,
etcdConfig *EtcdConfig) (Backend, error) {
// Config translation is needed here in order to keep the
// etcd package fully independent from the rest of the source tree.
backendConfig := etcd.BackendConfig{
Ctx: ctx,
Host: etcdConfig.Host,
User: etcdConfig.User,
Pass: etcdConfig.Pass,
+4 -1
View File
@@ -3,6 +3,7 @@
package kvdb
import (
"context"
"fmt"
)
@@ -13,7 +14,9 @@ const TestBackend = BoltBackendName
var errEtcdNotAvailable = fmt.Errorf("etcd backend not available")
// GetEtcdBackend is a stub returning nil and errEtcdNotAvailable error.
func GetEtcdBackend(prefix string, etcdConfig *EtcdConfig) (Backend, error) {
func GetEtcdBackend(ctx context.Context, prefix string,
etcdConfig *EtcdConfig) (Backend, error) {
return nil, errEtcdNotAvailable
}