mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 07:00:55 +02:00
graph/db: rename KVStoreOptions to StoreOptions
We'll re-use this options struct for our SQLStore too. So here we rename it to be more generic.
This commit is contained in:
@@ -1026,7 +1026,7 @@ func (d *DefaultDatabaseBuilder) BuildDatabase(
|
||||
"instances")
|
||||
}
|
||||
|
||||
graphDBOptions := []graphdb.KVStoreOptionModifier{
|
||||
graphDBOptions := []graphdb.StoreOptionModifier{
|
||||
graphdb.WithRejectCacheSize(cfg.Caches.RejectCacheSize),
|
||||
graphdb.WithChannelCacheSize(cfg.Caches.ChannelCacheSize),
|
||||
graphdb.WithBatchCommitInterval(cfg.DB.BatchCommitInterval),
|
||||
|
@@ -203,7 +203,7 @@ var _ V1Store = (*KVStore)(nil)
|
||||
|
||||
// NewKVStore allocates a new KVStore backed by a DB instance. The
|
||||
// returned instance has its own unique reject cache and channel cache.
|
||||
func NewKVStore(db kvdb.Backend, options ...KVStoreOptionModifier) (*KVStore,
|
||||
func NewKVStore(db kvdb.Backend, options ...StoreOptionModifier) (*KVStore,
|
||||
error) {
|
||||
|
||||
opts := DefaultOptions()
|
||||
|
@@ -61,8 +61,8 @@ func WithPreAllocCacheNumNodes(n int) ChanGraphOption {
|
||||
}
|
||||
}
|
||||
|
||||
// KVStoreOptions holds parameters for tuning and customizing a graph.DB.
|
||||
type KVStoreOptions struct {
|
||||
// StoreOptions holds parameters for tuning and customizing a graph DB.
|
||||
type StoreOptions struct {
|
||||
// RejectCacheSize is the maximum number of rejectCacheEntries to hold
|
||||
// in the rejection cache.
|
||||
RejectCacheSize int
|
||||
@@ -81,37 +81,37 @@ type KVStoreOptions struct {
|
||||
NoMigration bool
|
||||
}
|
||||
|
||||
// DefaultOptions returns a KVStoreOptions populated with default values.
|
||||
func DefaultOptions() *KVStoreOptions {
|
||||
return &KVStoreOptions{
|
||||
// DefaultOptions returns a StoreOptions populated with default values.
|
||||
func DefaultOptions() *StoreOptions {
|
||||
return &StoreOptions{
|
||||
RejectCacheSize: DefaultRejectCacheSize,
|
||||
ChannelCacheSize: DefaultChannelCacheSize,
|
||||
NoMigration: false,
|
||||
}
|
||||
}
|
||||
|
||||
// KVStoreOptionModifier is a function signature for modifying the default
|
||||
// KVStoreOptions.
|
||||
type KVStoreOptionModifier func(*KVStoreOptions)
|
||||
// StoreOptionModifier is a function signature for modifying the default
|
||||
// StoreOptions.
|
||||
type StoreOptionModifier func(*StoreOptions)
|
||||
|
||||
// WithRejectCacheSize sets the RejectCacheSize to n.
|
||||
func WithRejectCacheSize(n int) KVStoreOptionModifier {
|
||||
return func(o *KVStoreOptions) {
|
||||
func WithRejectCacheSize(n int) StoreOptionModifier {
|
||||
return func(o *StoreOptions) {
|
||||
o.RejectCacheSize = n
|
||||
}
|
||||
}
|
||||
|
||||
// WithChannelCacheSize sets the ChannelCacheSize to n.
|
||||
func WithChannelCacheSize(n int) KVStoreOptionModifier {
|
||||
return func(o *KVStoreOptions) {
|
||||
func WithChannelCacheSize(n int) StoreOptionModifier {
|
||||
return func(o *StoreOptions) {
|
||||
o.ChannelCacheSize = n
|
||||
}
|
||||
}
|
||||
|
||||
// WithBatchCommitInterval sets the batch commit interval for the interval batch
|
||||
// schedulers.
|
||||
func WithBatchCommitInterval(interval time.Duration) KVStoreOptionModifier {
|
||||
return func(o *KVStoreOptions) {
|
||||
func WithBatchCommitInterval(interval time.Duration) StoreOptionModifier {
|
||||
return func(o *StoreOptions) {
|
||||
o.BatchCommitInterval = interval
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user