lnd+channeldb: add graph cache option to channeldb

With this commit we forward the config option for disabling the channel
graph cache as a boolean to the channeldb. But we invert its meaning to
make the flag easier to understand.
This commit is contained in:
Oliver Gugger committed 2021-10-22 09:32:48 +02:00
1 parent a2ad533136
commit f216da32f3
6 files changed
+19 -2

No files matched your search

+13
View File
@@ -45,6 +45,11 @@ type Options struct {
// graph cache, so we can pre-allocate the map accordingly.
PreAllocCacheNumNodes int
// UseGraphCache denotes whether the in-memory graph cache should be
// used or a fallback version that uses the underlying database for
// path finding.
UseGraphCache bool
// clock is the time source used by the database.
clock clock.Clock
@@ -65,6 +70,7 @@ func DefaultOptions() Options {
RejectCacheSize: DefaultRejectCacheSize,
ChannelCacheSize: DefaultChannelCacheSize,
PreAllocCacheNumNodes: DefaultPreAllocCacheNumNodes,
UseGraphCache: true,
clock: clock.NewDefaultClock(),
}
}
@@ -93,6 +99,13 @@ func OptionSetPreAllocCacheNumNodes(n int) OptionModifier {
}
}
// OptionSetUseGraphCache sets the UseGraphCache option to the given value.
func OptionSetUseGraphCache(use bool) OptionModifier {
return func(o *Options) {
o.UseGraphCache = use
}
}
// OptionSetSyncFreelist allows the database to sync its freelist.
func OptionSetSyncFreelist(b bool) OptionModifier {
return func(o *Options) {