lnd/graph/db/interfaces.go

26 lines
995 B
Go
Raw Normal View History

package graphdb
import (
"github.com/lightningnetwork/lnd/graph/db/models"
"github.com/lightningnetwork/lnd/routing/route"
)
// NodeRTx represents transaction object with an underlying node associated that
// can be used to make further queries to the graph under the same transaction.
// This is useful for consistency during graph traversal and queries.
type NodeRTx interface {
// Node returns the raw information of the node.
Node() *models.LightningNode
// ForEachChannel can be used to iterate over the node's channels under
// the same transaction used to fetch the node.
ForEachChannel(func(*models.ChannelEdgeInfo, *models.ChannelEdgePolicy,
*models.ChannelEdgePolicy) error) error
// FetchNode fetches the node with the given pub key under the same
// transaction used to fetch the current node. The returned node is also
// a NodeRTx and any operations on that NodeRTx will also be done under
// the same transaction.
FetchNode(node route.Vertex) (NodeRTx, error)
}