mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-28 09:45:25 +02:00
graph/db: completely remove cache from KVStore
This commit is contained in:
parent
ba1d21d5c7
commit
bb3839e422
@ -93,8 +93,6 @@ func NewChannelGraph(cfg *Config, options ...ChanGraphOption) (*ChannelGraph,
|
||||
log.Debugf("Finished populating in-memory channel graph (took %v, %s)",
|
||||
time.Since(startTime), graphCache.Stats())
|
||||
|
||||
store.setGraphCache(graphCache)
|
||||
|
||||
return &ChannelGraph{
|
||||
KVStore: store,
|
||||
graphCache: graphCache,
|
||||
|
@ -3994,7 +3994,6 @@ func TestGraphCacheForEachNodeChannel(t *testing.T) {
|
||||
// Unset the channel graph cache to simulate the user running with the
|
||||
// option turned off.
|
||||
graph.graphCache = nil
|
||||
graph.KVStore.graphCache = nil
|
||||
|
||||
node1, err := createTestVertex(graph.db)
|
||||
require.Nil(t, err)
|
||||
|
@ -184,13 +184,12 @@ const (
|
||||
type KVStore struct {
|
||||
db kvdb.Backend
|
||||
|
||||
// cacheMu guards all caches (rejectCache, chanCache, graphCache). If
|
||||
// cacheMu guards all caches (rejectCache and chanCache). If
|
||||
// this mutex will be acquired at the same time as the DB mutex then
|
||||
// the cacheMu MUST be acquired first to prevent deadlock.
|
||||
cacheMu sync.RWMutex
|
||||
rejectCache *rejectCache
|
||||
chanCache *channelCache
|
||||
graphCache *GraphCache
|
||||
|
||||
chanScheduler batch.Scheduler
|
||||
nodeScheduler batch.Scheduler
|
||||
@ -227,15 +226,6 @@ func NewKVStore(db kvdb.Backend, options ...KVStoreOptionModifier) (*KVStore,
|
||||
return g, nil
|
||||
}
|
||||
|
||||
// setGraphCache sets the KVStore's graphCache.
|
||||
//
|
||||
// NOTE: this is temporary and will only be called from the ChannelGraph's
|
||||
// constructor before the KVStore methods are available to be called. This will
|
||||
// be removed once the graph cache is fully owned by the ChannelGraph.
|
||||
func (c *KVStore) setGraphCache(cache *GraphCache) {
|
||||
c.graphCache = cache
|
||||
}
|
||||
|
||||
// channelMapKey is the key structure used for storing channel edge policies.
|
||||
type channelMapKey struct {
|
||||
nodeKey route.Vertex
|
||||
|
Loading…
x
Reference in New Issue
Block a user