[#1367] writecache: Add background flushing objects limiter
To limit memory usage by background flush. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
8a6e3025a0
commit
e39378b1c3
12 changed files with 184 additions and 35 deletions
|
@ -44,6 +44,8 @@ type options struct {
|
|||
disableBackgroundFlush bool
|
||||
// pageSize is bbolt's page size config value
|
||||
pageSize int
|
||||
// flushSizeLimit is total size of flushing objects.
|
||||
flushSizeLimit uint64
|
||||
}
|
||||
|
||||
// WithLogger sets logger.
|
||||
|
@ -169,3 +171,10 @@ func WithPageSize(s int) Option {
|
|||
o.pageSize = s
|
||||
}
|
||||
}
|
||||
|
||||
// WithFlushSizeLimit sets flush size limit.
|
||||
func WithFlushSizeLimit(v uint64) Option {
|
||||
return func(o *options) {
|
||||
o.flushSizeLimit = v
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue