etcd: STM to allow prefetching of keys and full ranges

This commit adds more full range caching to the STM such that we'll
be able to prefetch keys and ranges on the kvdb level. This will allow
us to reduce roundtrips to etcd do fast iteration of small ranges.
This commit is contained in:
Andras Banki-Horvath committed 2021-09-14 13:12:19 +02:00
1 parent b0f3a08f2d
commit daec66a4e4
4 files changed
+495 -151

No files matched your search

+4 -2
View File
@@ -219,7 +219,8 @@ func (db *db) View(f func(tx walletdb.ReadTx) error, reset func()) error {
return f(newReadWriteTx(stm, etcdDefaultRootBucketId, nil))
}
return RunSTM(db.cli, apply, db.txQueue, db.getSTMOptions()...)
_, err := RunSTM(db.cli, apply, db.txQueue, db.getSTMOptions()...)
return err
}
// Update opens a database read/write transaction and executes the function f
@@ -240,7 +241,8 @@ func (db *db) Update(f func(tx walletdb.ReadWriteTx) error, reset func()) error
return f(newReadWriteTx(stm, etcdDefaultRootBucketId, nil))
}
return RunSTM(db.cli, apply, db.txQueue, db.getSTMOptions()...)
_, err := RunSTM(db.cli, apply, db.txQueue, db.getSTMOptions()...)
return err
}
// PrintStats returns all collected stats pretty printed into a string.