|
6 | 6 | "github.com/btcsuite/btcd/btcec/v2"
|
7 | 7 | "github.com/btcsuite/btcd/btcutil"
|
8 | 8 | "github.com/btcsuite/btcd/wire"
|
| 9 | + graphdb "github.com/lightningnetwork/lnd/graph/db" |
9 | 10 | "github.com/lightningnetwork/lnd/lnwire"
|
| 11 | + "github.com/lightningnetwork/lnd/routing/route" |
10 | 12 | )
|
11 | 13 |
|
12 | 14 | // DefaultConfTarget is the default confirmation target for autopilot channels.
|
@@ -216,3 +218,20 @@ type ChannelController interface {
|
216 | 218 | // TODO(roasbeef): add force option?
|
217 | 219 | CloseChannel(chanPoint *wire.OutPoint) error
|
218 | 220 | }
|
| 221 | + |
| 222 | +// GraphSource represents read access to the channel graph. |
| 223 | +type GraphSource interface { |
| 224 | + // ForEachNode iterates through all the stored vertices/nodes in the |
| 225 | + // graph, executing the passed callback with each node encountered. If |
| 226 | + // the callback returns an error, then the transaction is aborted and |
| 227 | + // the iteration stops early. Any operations performed on the NodeTx |
| 228 | + // passed to the call-back are executed under the same read transaction. |
| 229 | + ForEachNode(func(graphdb.NodeRTx) error) error |
| 230 | + |
| 231 | + // ForEachNodeCached is similar to ForEachNode, but it utilizes the |
| 232 | + // channel graph cache if one is available. It is less consistent than |
| 233 | + // ForEachNode since any further calls are made across multiple |
| 234 | + // transactions. |
| 235 | + ForEachNodeCached(cb func(node route.Vertex, |
| 236 | + chans map[uint64]*graphdb.DirectedChannel) error) error |
| 237 | +} |
0 commit comments