Skip to content

Commit a0a20bd

Browse files
committed
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.
1 parent 14ca086 commit a0a20bd

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

config_builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ func (d *DefaultDatabaseBuilder) BuildDatabase(
10261026
"instances")
10271027
}
10281028

1029-
graphDBOptions := []graphdb.KVStoreOptionModifier{
1029+
graphDBOptions := []graphdb.StoreOptionModifier{
10301030
graphdb.WithRejectCacheSize(cfg.Caches.RejectCacheSize),
10311031
graphdb.WithChannelCacheSize(cfg.Caches.ChannelCacheSize),
10321032
graphdb.WithBatchCommitInterval(cfg.DB.BatchCommitInterval),

graph/db/kv_store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ var _ V1Store = (*KVStore)(nil)
203203

204204
// NewKVStore allocates a new KVStore backed by a DB instance. The
205205
// returned instance has its own unique reject cache and channel cache.
206-
func NewKVStore(db kvdb.Backend, options ...KVStoreOptionModifier) (*KVStore,
206+
func NewKVStore(db kvdb.Backend, options ...StoreOptionModifier) (*KVStore,
207207
error) {
208208

209209
opts := DefaultOptions()

graph/db/options.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ func WithPreAllocCacheNumNodes(n int) ChanGraphOption {
6161
}
6262
}
6363

64-
// KVStoreOptions holds parameters for tuning and customizing a graph.DB.
65-
type KVStoreOptions struct {
64+
// StoreOptions holds parameters for tuning and customizing a graph DB.
65+
type StoreOptions struct {
6666
// RejectCacheSize is the maximum number of rejectCacheEntries to hold
6767
// in the rejection cache.
6868
RejectCacheSize int
@@ -81,37 +81,37 @@ type KVStoreOptions struct {
8181
NoMigration bool
8282
}
8383

84-
// DefaultOptions returns a KVStoreOptions populated with default values.
85-
func DefaultOptions() *KVStoreOptions {
86-
return &KVStoreOptions{
84+
// DefaultOptions returns a StoreOptions populated with default values.
85+
func DefaultOptions() *StoreOptions {
86+
return &StoreOptions{
8787
RejectCacheSize: DefaultRejectCacheSize,
8888
ChannelCacheSize: DefaultChannelCacheSize,
8989
NoMigration: false,
9090
}
9191
}
9292

93-
// KVStoreOptionModifier is a function signature for modifying the default
94-
// KVStoreOptions.
95-
type KVStoreOptionModifier func(*KVStoreOptions)
93+
// StoreOptionModifier is a function signature for modifying the default
94+
// StoreOptions.
95+
type StoreOptionModifier func(*StoreOptions)
9696

9797
// WithRejectCacheSize sets the RejectCacheSize to n.
98-
func WithRejectCacheSize(n int) KVStoreOptionModifier {
99-
return func(o *KVStoreOptions) {
98+
func WithRejectCacheSize(n int) StoreOptionModifier {
99+
return func(o *StoreOptions) {
100100
o.RejectCacheSize = n
101101
}
102102
}
103103

104104
// WithChannelCacheSize sets the ChannelCacheSize to n.
105-
func WithChannelCacheSize(n int) KVStoreOptionModifier {
106-
return func(o *KVStoreOptions) {
105+
func WithChannelCacheSize(n int) StoreOptionModifier {
106+
return func(o *StoreOptions) {
107107
o.ChannelCacheSize = n
108108
}
109109
}
110110

111111
// WithBatchCommitInterval sets the batch commit interval for the interval batch
112112
// schedulers.
113-
func WithBatchCommitInterval(interval time.Duration) KVStoreOptionModifier {
114-
return func(o *KVStoreOptions) {
113+
func WithBatchCommitInterval(interval time.Duration) StoreOptionModifier {
114+
return func(o *StoreOptions) {
115115
o.BatchCommitInterval = interval
116116
}
117117
}

0 commit comments

Comments
 (0)