graph/db: completely remove cache from KVStore

This commit is contained in:
Elle Mouton 2025-02-18 15:06:33 -03:00
parent ba1d21d5c7
commit bb3839e422
No known key found for this signature in database
GPG Key ID: D7D916376026F177
3 changed files with 1 additions and 14 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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