• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 15160205396

21 May 2025 10:48AM UTC coverage: 69.002%. First build
15160205396

Pull #9845

github

web-flow
Merge 4e76c0969 into c65441621
Pull Request #9845: batch: generic scheduler + benchmark tests

52 of 54 new or added lines in 5 files covered. (96.3%)

133997 of 194192 relevant lines covered (69.0%)

21981.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.82
/batch/kvdb.go
1
package batch
2

3
import (
4
        "context"
5
        "fmt"
6

7
        "github.com/lightningnetwork/lnd/kvdb"
8
        "github.com/lightningnetwork/lnd/sqldb"
9
)
10

11
// BoltBackend is a bbolt implementation of the sqldb.BatchedTx interface.
12
type BoltBackend[Q kvdb.RwTx] struct {
13
        db kvdb.Backend
14
}
15

16
// NewBoltBackend creates a new BoltBackend instance.
17
func NewBoltBackend[Q kvdb.RwTx](db kvdb.Backend) *BoltBackend[Q] {
342✔
18
        return &BoltBackend[Q]{db: db}
342✔
19
}
342✔
20

21
// ExecTx will execute the passed txBody, operating upon generic
22
// parameter Q (usually a storage interface) in a single transaction.
23
//
24
// NOTE: This is part of the sqldb.BatchedTx interface.
25
func (t *BoltBackend[Q]) ExecTx(_ context.Context, opts sqldb.TxOptions,
26
        txBody func(Q) error, reset func()) error {
5,203✔
27

5,203✔
28
        if opts.ReadOnly() {
5,203✔
NEW
29
                return fmt.Errorf("read-only transactions not supported")
×
NEW
30
        }
×
31

32
        return kvdb.Update(t.db, func(tx kvdb.RwTx) error {
10,406✔
33
                return txBody(any(tx).(Q)) //nolint:forcetypeassert
5,203✔
34
        }, reset)
5,203✔
35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc