mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 07:00:55 +02:00
multi: rename ReadTx to RTx
This commit is contained in:
@@ -188,7 +188,7 @@ func (c *ClientDB) bdb() kvdb.Backend {
|
||||
// NOTE: Part of the versionedDB interface.
|
||||
func (c *ClientDB) Version() (uint32, error) {
|
||||
var version uint32
|
||||
err := kvdb.View(c.db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(c.db, func(tx kvdb.RTx) error {
|
||||
var err error
|
||||
version, err = getDBVersion(tx)
|
||||
return err
|
||||
@@ -383,7 +383,7 @@ func (c *ClientDB) RemoveTower(pubKey *btcec.PublicKey, addr net.Addr) error {
|
||||
// LoadTowerByID retrieves a tower by its tower ID.
|
||||
func (c *ClientDB) LoadTowerByID(towerID TowerID) (*Tower, error) {
|
||||
var tower *Tower
|
||||
err := kvdb.View(c.db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(c.db, func(tx kvdb.RTx) error {
|
||||
towers := tx.ReadBucket(cTowerBkt)
|
||||
if towers == nil {
|
||||
return ErrUninitializedDB
|
||||
@@ -403,7 +403,7 @@ func (c *ClientDB) LoadTowerByID(towerID TowerID) (*Tower, error) {
|
||||
// LoadTower retrieves a tower by its public key.
|
||||
func (c *ClientDB) LoadTower(pubKey *btcec.PublicKey) (*Tower, error) {
|
||||
var tower *Tower
|
||||
err := kvdb.View(c.db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(c.db, func(tx kvdb.RTx) error {
|
||||
towers := tx.ReadBucket(cTowerBkt)
|
||||
if towers == nil {
|
||||
return ErrUninitializedDB
|
||||
@@ -432,7 +432,7 @@ func (c *ClientDB) LoadTower(pubKey *btcec.PublicKey) (*Tower, error) {
|
||||
// ListTowers retrieves the list of towers available within the database.
|
||||
func (c *ClientDB) ListTowers() ([]*Tower, error) {
|
||||
var towers []*Tower
|
||||
err := kvdb.View(c.db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(c.db, func(tx kvdb.RTx) error {
|
||||
towerBucket := tx.ReadBucket(cTowerBkt)
|
||||
if towerBucket == nil {
|
||||
return ErrUninitializedDB
|
||||
@@ -558,7 +558,7 @@ func (c *ClientDB) CreateClientSession(session *ClientSession) error {
|
||||
// response that do not correspond to this tower.
|
||||
func (c *ClientDB) ListClientSessions(id *TowerID) (map[SessionID]*ClientSession, error) {
|
||||
var clientSessions map[SessionID]*ClientSession
|
||||
err := kvdb.View(c.db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(c.db, func(tx kvdb.RTx) error {
|
||||
sessions := tx.ReadBucket(cSessionBkt)
|
||||
if sessions == nil {
|
||||
return ErrUninitializedDB
|
||||
@@ -612,7 +612,7 @@ func listClientSessions(sessions kvdb.ReadBucket,
|
||||
// channel summaries.
|
||||
func (c *ClientDB) FetchChanSummaries() (ChannelSummaries, error) {
|
||||
summaries := make(map[lnwire.ChannelID]ClientChanSummary)
|
||||
err := kvdb.View(c.db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(c.db, func(tx kvdb.RTx) error {
|
||||
chanSummaries := tx.ReadBucket(cChanSummaryBkt)
|
||||
if chanSummaries == nil {
|
||||
return ErrUninitializedDB
|
||||
|
@@ -77,7 +77,7 @@ func createDBIfNotExist(dbPath, name string) (kvdb.Backend, bool, error) {
|
||||
// set firstInit to true so that we can treat is initialize the bucket.
|
||||
if !firstInit {
|
||||
var metadataExists bool
|
||||
err = kvdb.View(bdb, func(tx kvdb.ReadTx) error {
|
||||
err = kvdb.View(bdb, func(tx kvdb.RTx) error {
|
||||
metadataExists = tx.ReadBucket(metadataBkt) != nil
|
||||
return nil
|
||||
})
|
||||
|
@@ -129,7 +129,7 @@ func (t *TowerDB) bdb() kvdb.Backend {
|
||||
// NOTE: Part of the versionedDB interface.
|
||||
func (t *TowerDB) Version() (uint32, error) {
|
||||
var version uint32
|
||||
err := kvdb.View(t.db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(t.db, func(tx kvdb.RTx) error {
|
||||
var err error
|
||||
version, err = getDBVersion(tx)
|
||||
return err
|
||||
@@ -150,7 +150,7 @@ func (t *TowerDB) Close() error {
|
||||
// returned if the session could not be found.
|
||||
func (t *TowerDB) GetSessionInfo(id *SessionID) (*SessionInfo, error) {
|
||||
var session *SessionInfo
|
||||
err := kvdb.View(t.db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(t.db, func(tx kvdb.RTx) error {
|
||||
sessions := tx.ReadBucket(sessionsBkt)
|
||||
if sessions == nil {
|
||||
return ErrUninitializedDB
|
||||
@@ -389,7 +389,7 @@ func (t *TowerDB) DeleteSession(target SessionID) error {
|
||||
// they exist in the database.
|
||||
func (t *TowerDB) QueryMatches(breachHints []blob.BreachHint) ([]Match, error) {
|
||||
var matches []Match
|
||||
err := kvdb.View(t.db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(t.db, func(tx kvdb.RTx) error {
|
||||
sessions := tx.ReadBucket(sessionsBkt)
|
||||
if sessions == nil {
|
||||
return ErrUninitializedDB
|
||||
@@ -485,7 +485,7 @@ func (t *TowerDB) SetLookoutTip(epoch *chainntnfs.BlockEpoch) error {
|
||||
// database.
|
||||
func (t *TowerDB) GetLookoutTip() (*chainntnfs.BlockEpoch, error) {
|
||||
var epoch *chainntnfs.BlockEpoch
|
||||
err := kvdb.View(t.db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(t.db, func(tx kvdb.RTx) error {
|
||||
lookoutTip := tx.ReadBucket(lookoutTipBkt)
|
||||
if lookoutTip == nil {
|
||||
return ErrUninitializedDB
|
||||
|
@@ -46,7 +46,7 @@ func getMigrations(versions []version, curVersion uint32) []version {
|
||||
|
||||
// getDBVersion retrieves the current database version from the metadata bucket
|
||||
// using the dbVersionKey.
|
||||
func getDBVersion(tx kvdb.ReadTx) (uint32, error) {
|
||||
func getDBVersion(tx kvdb.RTx) (uint32, error) {
|
||||
metadata := tx.ReadBucket(metadataBkt)
|
||||
if metadata == nil {
|
||||
return 0, ErrUninitializedDB
|
||||
|
Reference in New Issue
Block a user