etcd: remove (unused) etcd root bucket prefix
This commit removes the unused prefix from the etcd backend config as etcd key space separation in LND is implemented by using namespaces instead.
This commit is contained in:
6 files changed
+16
-27
No files matched your search
@@ -23,6 +23,10 @@ const (
|
||||
|
||||
// etcdLongTimeout is a timeout for longer taking etcd operatons.
|
||||
etcdLongTimeout = 30 * time.Second
|
||||
|
||||
// etcdDefaultRootBucketId is used as the root bucket key. Note that
|
||||
// the actual key is not visible, since all bucket keys are hashed.
|
||||
etcdDefaultRootBucketId = "@"
|
||||
)
|
||||
|
||||
// callerStats holds commit stats for a specific caller. Currently it only
|
||||
@@ -152,11 +156,6 @@ type BackendConfig struct {
|
||||
// skip TLS verification.
|
||||
InsecureSkipVerify bool
|
||||
|
||||
// Prefix the hash of the prefix will be used as the root
|
||||
// bucket id. This enables key space separation similar to
|
||||
// name spaces.
|
||||
Prefix string
|
||||
|
||||
// Namespace is the etcd namespace that we'll use for all keys.
|
||||
Namespace string
|
||||
|
||||
@@ -243,7 +242,7 @@ func (db *db) getSTMOptions() []STMOptionFunc {
|
||||
func (db *db) View(f func(tx walletdb.ReadTx) error, reset func()) error {
|
||||
apply := func(stm STM) error {
|
||||
reset()
|
||||
return f(newReadWriteTx(stm, db.config.Prefix))
|
||||
return f(newReadWriteTx(stm, etcdDefaultRootBucketId))
|
||||
}
|
||||
|
||||
return RunSTM(db.cli, apply, db.txQueue, db.getSTMOptions()...)
|
||||
@@ -259,7 +258,7 @@ func (db *db) View(f func(tx walletdb.ReadTx) error, reset func()) error {
|
||||
func (db *db) Update(f func(tx walletdb.ReadWriteTx) error, reset func()) error {
|
||||
apply := func(stm STM) error {
|
||||
reset()
|
||||
return f(newReadWriteTx(stm, db.config.Prefix))
|
||||
return f(newReadWriteTx(stm, etcdDefaultRootBucketId))
|
||||
}
|
||||
|
||||
return RunSTM(db.cli, apply, db.txQueue, db.getSTMOptions()...)
|
||||
@@ -278,7 +277,7 @@ func (db *db) PrintStats() string {
|
||||
func (db *db) BeginReadWriteTx() (walletdb.ReadWriteTx, error) {
|
||||
return newReadWriteTx(
|
||||
NewSTM(db.cli, db.txQueue, db.getSTMOptions()...),
|
||||
db.config.Prefix,
|
||||
etcdDefaultRootBucketId,
|
||||
), nil
|
||||
}
|
||||
|
||||
@@ -286,7 +285,7 @@ func (db *db) BeginReadWriteTx() (walletdb.ReadWriteTx, error) {
|
||||
func (db *db) BeginReadTx() (walletdb.ReadTx, error) {
|
||||
return newReadWriteTx(
|
||||
NewSTM(db.cli, db.txQueue, db.getSTMOptions()...),
|
||||
db.config.Prefix,
|
||||
etcdDefaultRootBucketId,
|
||||
), nil
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ const TestBackend = EtcdBackendName
|
||||
|
||||
// GetEtcdBackend returns an etcd backend configured according to the
|
||||
// passed etcdConfig.
|
||||
func GetEtcdBackend(ctx context.Context, prefix string,
|
||||
etcdConfig *EtcdConfig) (Backend, error) {
|
||||
func GetEtcdBackend(ctx context.Context, 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.
|
||||
@@ -28,7 +28,6 @@ func GetEtcdBackend(ctx context.Context, prefix string,
|
||||
CertFile: etcdConfig.CertFile,
|
||||
KeyFile: etcdConfig.KeyFile,
|
||||
InsecureSkipVerify: etcdConfig.InsecureSkipVerify,
|
||||
Prefix: prefix,
|
||||
Namespace: etcdConfig.Namespace,
|
||||
CollectCommitStats: etcdConfig.CollectStats,
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ const TestBackend = BoltBackendName
|
||||
var errEtcdNotAvailable = fmt.Errorf("etcd backend not available")
|
||||
|
||||
// GetEtcdBackend is a stub returning nil and errEtcdNotAvailable error.
|
||||
func GetEtcdBackend(ctx context.Context, prefix string,
|
||||
etcdConfig *EtcdConfig) (Backend, error) {
|
||||
func GetEtcdBackend(ctx context.Context, etcdConfig *EtcdConfig) (
|
||||
Backend, error) {
|
||||
|
||||
return nil, errEtcdNotAvailable
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user